Add an issue that is not available for iOS replication in the previous blog to be used in combination
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <Metaname= "Viewport"content= "Width=device-width, initial-scale=1.0"> <Metahttp-equiv= "X-ua-compatible"content= "Ie=edge"> <title>Document</title></Head><Body> <spanID= "Data">Copy me to the Clipboard</span> <Buttonclass= "button"type= "button"ID= "button">Click Copy</Button> <Scriptsrc= "Http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></Script> <Script> $("#button"). Click (function () { if(Navigator.userAgent.match (/(Iphone|ipod|ipad);?/i)) {//iOS varCopydom=Document.queryselector ('#data'); //node to copy text from varRange=Document.createrange (); //Select the node you want to replicateRange.selectnode (copydom); //Execute selected Elementwindow.getselection (). AddRange (range); //perform a copy operation varsuccessful=Document.execcommand ('Copy'); Try { varmsg=successful? 'successful' : 'unsuccessful'; Console.log ('Copy is' +msg); } Catch(Err) {Console.log ('Oops, unable to copy'); } //Remove the selected elementwindow.getselection (). Removeallranges (); } Else{Console.log ("Android does not support this way of copying") } }); </Script></Body></HTML>
iOS copy text to clipboard