I believe this also works. AFAIK jQuery events use the literal element instead of the jQuery object when triggering events. Basically, this should be your regular DOM element with normal JavaScript properties.
$(document).click(function(event) { myparent = $(this.parentNode); //jquery obj parent = $(this.parentNode)[0]; //plain DOM obj myself = $(this); //jquery obj; $elf = this; //plain DOM obj });
Note: sometimes using "I" as a variable is bad / causes conflicts with certain libraries, so I used $ eelf. $ In $ elf is not as special as a jQuery convention or anything else.
Garet claborn
source share