javascript - Zclip not copy text -
javascript - Zclip not copy text -
zclip plugin not re-create text.
<head> <script type = "text/javascript" src = "jquery.min.js"></script> <script type = "text/javascript" src = "jquery.zclip.min.js"></script> </head> <button id = "copy-description">132</button> <p id = "description">123456789132456789</p> <script type = "text/javascript"> $(document).ready(function(){ $('#copy-description').click(function(){ $('#copy-description').zclip({ path:'zeroclipboard.swf', copy:function(){return $('p#description').val();} }); }); }); </script>
when click on button, clipboard not change. seek jquery v1.11.1, , v 1.6 help.
http://jsfiddle.net/lnd6p/
this should work. got rid of space id
tags in html.
<button id="copy-description">132</button> <p id="description">123456789132456789</p>
then changed .val()
.text()
since we're getting text div not form element.
$(document).ready(function(){ $('#copy-description').click(function(){ $('#copy-description').zclip({ path:'http://ajax.cdnjs.com/ajax/libs/zclip/1.1.2/zeroclipboard.swf', //you can alter local version, had to testing. copy:function(){ homecoming $('#description').text(); //changed .val() .text() } }); }); });
javascript jquery clipboard zclip
Comments
Post a Comment