1. A jquery library must be introduced first
<script type= "Text/javascript" src= "js/jquery.js" ></script><script type= "Text/javascript" src= "js/ Jquery.zclip.min.js "></script>
2.js Implement click-To-Copy code
<script type= "Text/javascript" > $ (function () { $ (' #copy_input '). Zclip ({ //copy_input means the button path: ' Zeroclipboard.swf ', copy:function () {//Copy contents return $ (' #mytext '). Val (); MyText represents content},aftercopy:function () {//Copy Success //$ ("<span id= ' msg '/>"). InsertAfter ($ (' #copy_input ')). Text ( ' Replication success '); Alert (' Copy succeeded ');} ); </script>
3. Configuration Instructions
path:swf path (replication mainly uses Flash to resolve different browser replication)
Copy: What you want to copy, either static or return dynamic content
Beforecopy: The function to be done before copying;
Aftercopy: function to be done after copying;
4.3 methods are available
Show:$ (selected). Zclip (' show '); copy function valid
Hide:$ (selected). Zclip (' hide '); Invalid copy function
Remove:$ (selected). Zclip (' remove '); Complete removal of replication functionality
5. After successful operation, click the Copy button and a prompt will pop up indicating that the copy to the Clipboard is in effect. Pop-up box appears "Copied Text to Clipboard" English characters, a bit inconsistent with the Chinese people use the habit, change it to "successfully copied to the Clipboard", in the Jquery.zclip.min.js file found "Copied text to clipboard" replaced by "Successfully copied to the Clipboard" will be OK.
Note: When there is a aftercopy () function to handle the successful action, there will be no fifth-step frame.
6. File to be placed in the server to run, directly run the HTML file is not
jquery Implementation click Copy to Clipboard