I'm using ZeroClipboard v2.2.0 from cdnjs
Running this code:
$(document).ready(function() {
$("tr td:last-child").each(function() {
var element = $(this);
var button = $('<button type="button" class="btn btn-xs copy-to-clipboard" data-clipboard-text="' + element.html() + '" title="Copy UUID"><span class="glyphicon glyphicon-file"></span></button>');
button.tooltip();
button.appendTo(element);
var clipboard = new ZeroClipboard(button);
clipboard.on("ready", function(event) {
clipboard.on("aftercopy", function(event) {
alert("Copied: " + event.data["text/plain"]);
});
});
});
});
This code inserts the copy to clipboard
buttons in the table:
But when i drag over one of these copy to clipboard
buttons, firebug shows this exception: uncaught exception: Error in Actionscript. Use a try/catch block to find error.
What am i doing wrong?
Solved it. Had to add some configuration:
ZeroClipboard.config({
swfPath: '//cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.2.0/ZeroClipboard.swf',
forceHandCursor: true,
debug: true,
trustedDomains: [window.location.host, "cdnjs.cloudflare.com"]
});