Kotenarok HellHound
Kotenarok HellHound

Reputation: 1

zClip not copying value on Google Chrome

Here is my code.

$('a.copy').each(function(){
    var $this = $(this);
    $this.zclip({
        path : 'path/to/ZeroClipboard.swf',
        copy : function(){
            var copyText = $this.prev().val();
            console.debug(copyText);
            return copyText;
       }
    });
 });

After clicking the button, 'copyText' is printed out correctly (via console.debug), but the value seems not to be returned.

The problem is seems to be "iButton" plugin, when i comment that plugin, the zclip is worked, but I don't know why. Anyone experienced this issue?

P.S. Firefox works fine

Upvotes: 0

Views: 965

Answers (2)

Doug
Doug

Reputation: 749

This has had me stumped for a couple hours, I have a project using both iButton and ZeroClipboard and have the same issues.

The problem is with iButton attaching a mouseup event to $('document') that interferes with other mouseup events. I don't have time to hunt down a complete fix for the iButton component but searching for the following line in jquery.ibutton.js Rev: 1.0.03

$('document').bind("mouseup.iButton_" + id + " touchend.iButton_" + id, function(e) {

and replace it with

$container.bind("mouseup.iButton_" + id + " touchend.iButton_" + id, function(e) {

cleared the problem up for me, but there is probably a better fix.

Upvotes: 1

Sora
Sora

Reputation: 2551

 $(document).ready(function(){    
 $('a.copy').each(function(){
   $this.zclip({
    path : 'path/to/ZeroClipboard.swf',
    copy : function(){
    var copyText=$(this).prev().val();
    console.debug(copyText);
    return copyText ;   
   }
    });
   });
 });

first make sure that you include the jquery library and zclip js file

Upvotes: 0

Related Questions