midjQuery
What is the difference between $(this) and this in jQuery?
Updated May 14, 2026
Short answer
this refers to the raw DOM element, while $(this) converts it into a jQuery object with access to jQuery methods.
Deep explanation
Inside event handlers and callbacks, 'this' refers to the native DOM element triggering the event.
However, DOM elements do not have jQuery methods. Wrapping the element using $(this) converts it into a jQuery object.
Key distinction:
- this → Native DOM node
- $(this) → jQuery wrapper object
Performance note: Repeatedly wrapping the same element can create unnecessary overhead. Cache jQuery objects when reused multiple times.
Real-world example
Interactive tables commonly use $(this) inside click handlers to highlight the selected row dynamically.
Common mistakes
- Trying to call jQuery methods directly on 'this' without wrapping it first.
Follow-up questions
- Why do we wrap this with $()?
- Is $(this) slower than this?
- Can native DOM methods be used on this?