I am running the following code on a Drupal page
(function ($) {
var client = new ZeroClipboard(document.getElementById("click-to-copy"), {
moviePath: "http://example.com/sites/all/libraries/zeroclipboard-2.2.0/dist/ZeroClipboard.swf"
});
client.on("load", function (client) {
alert("Hello from the load event");
client.on("complete", function (client, args) {
client.setText("here is some text");
});
});
} (jQuery));
But I am not seeing any results.
(1) How can I tell if the client
object has been constructed correctly? (I know the moviePath
value is correct.)
(2) When I click the button with id "click-to-copy", I don't see any load event firing (looking in the Console of the Developer Tools window for both Chrome and Firefox.)
Anyone have any ideas how I can go about debugging this??
(Note I wrapped this code in the closure because it originally contained calls to jQuery '$' functions.)
My code was looking for the wrong events.
Reading the docs at https://github.com/zeroclipboard/zeroclipboard, particularly the "Static Events" section of /docs/api/ZeroClipboard.md
, explained that the events I should have been listening for were ready, copy and aftercopy. After making this change I got my code working.