zClip beforeCopy and afterCopy events not firing and nothing in clipboard

426 views Asked by At

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?

0

There are 0 answers