javascript - Controlling context in jQuery button proxy function -


i need isolate value attached button when clicked in jquery. however, need wrap click handler in $.proxy(...) context maintained subsequent function calls:

$('#' + tab.buttonid).click($.proxy(function() {    this.pop($(this).val()); }, this)); 
  • this.pop needs apply object
  • $(this).val() need come button

how make each call this reference right thing?

you use e.target point button object:

$('#' + tab.buttonid).click($.proxy(function(e) {    this.pop($(e.target).val()); }, this)); 

Comments