If this cant be done for cross-browser, then any comments would be much appreciated.
What I am trying to achieve is multiple "copy to clipboard" links on my page like this for example...
<a href="#" data-copy="<?php echo $original[0]; ?>" class="copy">Copy Original Link</a>
<a href="#" data-copy="<?php echo $medium[0]; ?>" class="copy">Copy Medium Link</a>
<a href="#" data-copy="<?php echo $web[0]; ?>" class="copy">Copy Web Link</a>
Just not really having much luck getting anything to work.
I am using zClip, and trying to fire using jQuery onClick and a data attribute, like below.
But just cannot get it to work. See fiddle.
var copyText = 0;
$("a.copy").on('click', function () {
var copyText = $(this).attr('data-copy');
return false;
}).each(function () {
$(this).zclip({
path: 'http://zeroclipboard.googlecode.com/svn-history/r10/trunk/ZeroClipboard.swf',
copy: copyText,
beforeCopy: function () {
},
afterCopy: function () {
alert(copyText + " has been copied!");
}
});
});
Please see my new fiddle here with zClip jquery plugin being used.
Thank in advance for any suggestions.