javascript - Using this(class object) inside click event function -


i have click event on button, have pass class object call function inside click event.i requirement following

$(this).on('click', function(){      this.callfunc(); }); 

for now, storing in self , using in click function.currently having following code achieve this.

var self = this; $(this).on('click', function(){      self.callfunc(); }); 

is there way use directly inside click function?

use $.proxy pass custom execution context callback function

$(this).on('click', $.proxy(function(){     this.callfunc(); }, this)); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -