Reputation:
I'm using on()
to mimic live()
and can't for the life of me figure out how to properly reference $(this)
so it references the selector I passed in. Here's the code, $(this)
returns "body"
instead of "select"
.
$("body").on("change", "select", function(e){
console.log($(this));
});
Upvotes: 1
Views: 65
Reputation: 148130
You can use event.target to the the source of event.
$("body").on("change", "select", function(e){
console.log($(e.target));
});
Upvotes: 1
Reputation: 3462
try this
$(e.currentTarget);
e is actually the event arguments for the event and that's what you want I beleive.
Upvotes: 2