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

Long question

What is event bubbling and delegation my guess is that when an event listener is applied it also gets applied to its parents and ancestors, so you must be specific when applying an event listener.

Also, what is the event object? This one i don't even have a guess it confuses me a lot.

1 Answer

Robert Manolis
STAFF
Robert Manolis
Treehouse Guest Teacher

Hey Nas Jones, the event object is basically just what it sounds like. It's a JS object that represents an event that has occurred. It has properties and methods just like any other object. And you can log it out to the console to expand and explore the object and its properties and methods.

Bubbling and capturing have to do with event propagation, which is basically how the event effects elements up and down the DOM tree.

And event delegation is the technique of adding a listener to a container element, and then conditionally determining which descendants of that element will actually trigger some effect when the event fires.

For more info and a deeper dive, you can read more about all these topics on MDN and W3Schools. :smiley:

I see, thanks for the help!