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 trial

JavaScript jQuery Basics (2014) Creating a Simple Lightbox Perform: Part 1

Miles Falk
Miles Falk
6,566 Points

This vs event.target

What is the significance in using 'This' instead of 'event.target' when obtaining a reference to the current element?

Thanks :)

1 Answer

Someone else I'm sure will give a more concise answer, but here is my stab at it. This: calls a jquery object with whatever is available to it as that jquery object. Event.target just references the element. Therefore none of the jquery attributes are associated with it.

Miles Falk
Miles Falk
6,566 Points

Gotcha. Thanks for the clear explanation!