Copy codeThe Code is as follows:
<Script type = "text/javascript" src = "js/jquery. js"> </script>
<Script type = "text/javascript" src = "js/jquery. zclip. min. js"> </script>
Copy codeThe Code is as follows:
$ (Function (){
$ ('# Copy_input'). zclip ({
Path: 'js/ZeroClipboard.swf ',
Copy: function () {// copy content
Return $ ('# mytext'). val ();
},
AfterCopy: function () {// copied successfully
$ ("<Span id = 'msg '/>"). insertAfter ($ (' # copy_input '). text ('copied successfully ');
}
});
});
It is worth noting that if the copied content comes from input and textarea in the input box, the copy object uses:
Copy codeThe Code is as follows:
Copy: function (){
Return $ ('# mytext'). val ();
}
If the copied content comes from the page elements such as div and p, the copy object uses:
Copy codeThe Code is as follows:
Copy: $ ('# mytext'). text ();