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

Event handlers and listeners??

Is it correct to say "An "Event listener" is where an element or object is set to wait for an event, it has an "event handler" function attached to it and listens out in case of an event. The event can be set to wait for when something is clicked or pressed or when loaded."

Is the event handler different from an event listener or are they similar, or an extension of each other or just terminology confusing perception? Is the above definition accurate to describe these two methods.?

2 Answers

In my opinion there's no such difference. it's just another terminology for the same thing.

I see, thank you very much for replying.

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

My understanding is that an "Event Handler" is like a method in that it is a function that acts on some sort of trigger. A function that does something.

Whereas an "Event Listener" is what triggers that action, be it an onclick or a mousemove.

I see, thank you very much for replying.