I am trying to implement zclip on my Wordpress site to copy the result of some dynamically generated text. I have code that works fine as a standalone html page with embedded jquery, but it doesn't seem to port well to my Wordpress site. I have placed the code inline on my WP site, but nothing happens when I press the "Copy" button. Here's the standalone page code that works. Any ideas?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://www.steamdev.com/zclip/js/jquery.zclip.min.js"></script>
<script type="text/javascript">
jQuery(function($) {
alert("This code is working.");
$("#copybutton").zclip({
path: "http://www.ultrasoundoftheweek.com/scripts/zc/ZeroClipboard2.swf",
copy: function() {
return $('#result').html();
},
beforeCopy: function() {},
afterCopy: function() {
alert('Copy To Clipboard : \n' + $('#result').html());
}
});
});
</script>
<body>
<button id="copybutton" > Copy To ClipBoard </button>
<div id="result">Markosian KA, PaÄtian NA, Nalbandian RM. [Relation between the membrane and soluble forms of dopamine beta-monooxygenase]. Biokhimiia. 1990;55:(1)147-54. [<a href="http://www.ncbi.nlm.nih.gov/pubmed/2344453" target="_blank">pubmed</a>]</div>
</body>
For anyone running into this problem, I figured it out. The code was working fine, but the zclip movie was not positioned over my button. I was able to fix this easily by wrapping my button in a div and setting the position to relative: