Search code examples
javascriptzeroclipboard

client.on is not a function ZeroClipboard/Javascript


Here is all the relevant code:

<script src="https://cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.1.6/ZeroClipboard.Core.js"></script>

ZeroClipboard.config( { swfPath: "https://cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.1.6/ZeroClipboard.swf" } );

    var client = new ZeroClipboard(pastawell);
    client.on( "copy", function (event) {
      var clipboard = event.clipboardData;
      clipboard.setData( "hi");
    });

This is practically copy pasted from their example, but it says that it isn't a function. What am I doing wrong?


Solution

  • I'm having the same issue:

    try to use https://cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.1.6/ZeroClipboard.min.js instead (note absence of 'Core' in url)