javascript - ZeroClipboard - How to use -
i'm using 1 http://jonrohan.github.io/zeroclipboard/
i spent whole day figuring out how use zeroclipboard(zc). read instructions: https://github.com/jonrohan/zeroclipboard/blob/master/docs/instructions.md , followed step step , couldn't it.
i tried again , again , again can't work. spent hours reading other guides @ stackoverflow , other pages both couldn't work. moreover, of answers outdated.
can please write simple working zc code copies paragraph tag:
<p>hello, i'm armesh</p>
then tell me each part of zc code , why wrote way.
i plan use zc copy references generated generator: http://anonoz.com/armesh/
this code wrote, link references correct:
<!doctype html> <html> <head> <title>zero test</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="javascripts/zeroclipboard.js"></script> </head> <script language="javascript"> $(document).ready(function() { var clip = new zeroclipboard($("#copy_button"), { moviepath: "javascripts/zeroclipboard.swf" }); }); </script> <body> <button id='#copy_button' data-clipboard-target='to_copy'><b>copy clipboard</b></button> <p id='to_copy'>123456</p> </body> </html>
i ran code/web page above in google chrome, there no errors log in console. it's blank.
ok got working, think code posted above me correct.
the problem was testing on local, , browsers prevent flash running locally. caused fail despite code being correct.
as last resort, uploaded web server , tried online, worked fine.
so, test zeroclipboard online after uploading web server.
Comments
Post a Comment