JQuery Methods Not Working On 'this' Inside An Event Handler
When I use the below, I cannot get the jQuery this to hide the element. $('.purplePanda').click(function(e){ this.hide(); }); I get this error: Uncaught TypeError: this.hide is
Solution 1:
Replace
this.hide();
with
$(this).hide();
Thus your function should be like
$('.purplePanda').click(function(e){
$(this).hide();
});
See the official documentation here
Post a Comment for "JQuery Methods Not Working On 'this' Inside An Event Handler"