Reputation: 91
Is it possible to save $(this) as a variable inside of a jquery event so that you can compare it against other varaibles holding elements? If so, how would you go about doing this?
Upvotes: 0
Views: 61
Reputation:
I do this al the time! :)
var $el = $(this);
Note $ before el. This does nothing actually, it is for you to remember that this is jquery var.
Upvotes: 1
Reputation: 15699
Yes why not.
$(element).click(function(){ //any event
var th = $(this);
});
Upvotes: 0