onclick - jQuery button doesn't work until second click - how do I bind <a> with zClip before first click -
a.copy-btn gets zclip attached on first click.
on second click contents of < p > (ggg/aaa) gets copied.
i want copied on first click, , cant 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 open other solutions entirely. tried addclass < p > before 'copy' triggered -- , copying p.classname -- didn't work -- interested know why.
i have never used zclip before, taking quick @ usage documentation appears though not need bind click. should need working is:
$(document).ready(function(){ $button = $('a.copy-btn'); $button.zclip({ path:'js/zeroclipboard.swf', copy:$button.prev('p.copiedtext').text() }); });
Comments
Post a Comment