[Solved] Binding this? Getting undefined?
[ad_1] The bind is placed wrong. You want to bind this to the event handler function, not to the jQuery collection of objects which are returned from the ‘on’ method. Following sample should work: $(‘#btn’).on(‘click’, function(event){ console.log(this.test); }.bind(this)); However, it’s not very good practice. Better approach could be to reference the this object by some … Read more