Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JQuery and ‘this’ keyword Re: JQuery and ‘this’ keyword

#72039
Chris Coyier
Keymaster

$(this) becomes a jQuery set, and thus is able to have jQuery functions performed on it. At least that’s how I understand it. With "this" by itself, that’s a reference to the element, and you have direct access to DOM stuff like this.offsetLeft or whatnot, but you don’t get all the fun jQuery abilities (like chaining, e.g. $(this).addClass("yeah").slideDown(); ) I’m not even sure if this.addClass(); will work… did you try it?