0

I am using the zclip jQuery addon to copy text on a web page. WhenI look up in Fiddler, the zclip script file and also the jQuery file are getting loaded without errors, but on clicking the copy link, nothing is happening.

Everything seems to be correctly setup. The copy code links are created correctly as I can see them on my web page. Also, the code within document ready event is firing as I saw with my javascript debugger.

<script>
$(".reCodeBlock").each(function () {
    var snippet = $(this);

    var htmlToInsert = "<div><a class='copy-code cp'>Copy code</a></div>";

    snippet.before(htmlToInsert);
});

$(document).ready(function () {

    $(".copy-code").each(function () {
        var copyLink = $(this); alert( copyLink.parent().next().text());
        copyLink.zclip({
            path: 'http://www.kandoocode.com/zeroclipboard/ZeroClipboard.swf',
            copy: function(){ return copyLink.parent().next().text();},
            beforeCopy: function(){ alert('1');
              },
            afterCopy: function () { alert('2');
               }
        });
    });

});
</script>

EDIT 1:
May be it's the jQuery version I am using. I have jQuery 1.9.1 and zClip may be incompatible with version 1.91. But not sure?

Sunil
  • 20,653
  • 28
  • 112
  • 197
  • `http://www.abc.com/zeroclipboard/ZeroClipboard.swf` link seems broken. Use ZeroClipboard.swf from another location (a local copy would be nice). For testing purposes, see [this question](http://stackoverflow.com/questions/15660327/zclip-zeroclipboard-swf-deleted-need-new-file) – Stephane Lallemagne Jan 04 '14 at 21:07
  • @StephaneLallemagne - Actually I had changed the original URL. The correct URL for the swf is now in the code snippet. – Sunil Jan 04 '14 at 21:14
  • 1
    ZClip hasn't been updated since 2011, and that may be the reason as jQuery script has changed since 2011. – Sunil Jan 04 '14 at 21:34

0 Answers0