Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMayank Munjal
Front End Web Development Techdegree Graduate 18,120 PointsNot able to understand the use of "THIS" even after watching the video.
Can someone please explain the use of 'this' in the video?
1 Answer
Steven Parker
231,269 PointsThe current event target is "this".
Inside an event handler, the element that caused the event to happen is known as the event target. The function creates a variable named "this" for you and assigns it to that element.
Then, as shown in the video, by passing it to jQuery, (as "$(this)
"), it is converted into a jQuery object so jQuery methods can be used with it.