Closure not working in ZeroClipboard

后端 未结 1 1614
说谎
说谎 2021-01-24 07:38

I have the following JS code for ZeroClipBoard :

onComplete: function(item) {

            var text= $(item).html();//Not working when I hover the clip
                  


        
相关标签:
1条回答
  • 2021-01-24 07:51

    The value won't be preserved in the function call, you need to use a $.proxy instead:

            clip.addEventListener('mouseOver', $.proxy(function(client) {
                // "this" is now set to text
                clip.setText(this);
            }, text));
    
    0 讨论(0)
提交回复
热议问题