Simple javascript to mimic jQuery behaviour of using this in events handlers
- by Marco Demaio
This is not a question about jQuery, but about how jQuery implements such a behaviour.
In jQuery you can do this:
$('#some_link_id').click(function()
{
alert(this.tagName); //displays 'A'
})
could someone explain in general terms (no need you to write code) how do they obtain to pass the event's caller html elments (a link in this specific example) into the this keyword?
I obviously tried to look 1st in jQuery code, but I could not understand one line.
Thanks!