a.copy-btn gets zClip attached to it on the first click.
On the second click the contents of < p > (ggg/aaa) gets copied.
I want it to get copied on the first click, and I cant get it working.
<p class="copiedText">ggg</p>
<a class="copy-btn" href="#">a copy button</a><br /><br />
<p class="copiedText">aaa</p>
<a class="copy-btn" href="#">a copy button</a><br /><br />
$(document).ready(function(){
$('a.copy-btn').click(function(){
$(this).zclip({
path:'js/ZeroClipboard.swf',
copy:$(this).prev('p.copiedText').text()
});
});
});
I am also open to other solutions entirely. I tried addClass to the < p > before 'copy' is triggered -- and then copying the p.ClassName -- but this didn't work -- I would be interested to know why.
I have never used zclip before, but taking a quick look at the Usage documentation it appears as though you do not need to bind it to a click. So all you should need to get it working is: