Multiple zclip functions - only the last one works

435 views Asked by At

I'm using the "zclip" jquery function to perform a cross-browser copy-to-clipboard, when a user clicks on a button.

However, as soon as I assign the zclip function to yet another button, the first one stops working.

The code is:

function setupClipboard(o, i) {

    o.find('.copytext').zclip({
        path: 'js/zclip/ZeroClipboard.swf',
        copy: function() {
            return $('#customtext' + i).val();
        }
    });

}

You can see the problem here: http://toolii.com/apps/the-character-counter/ (Watch the console.log in the browser to see what it tries to copy.)

Do any of you have an idea of how to solve this problem?

Thanks in advance!

Kind regards, Tobias

1

There are 1 answers

0
Tobias Christian Jensen On

Turned out that I just had to remove all existing instances of zclip and inserting them again, each time I added a field.