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
Kevin Lozandier
Courses Plus Student 53,747 PointsWhy global event handlers are being used instead of addEventListener for events?
Hey, @andrewchalkley:
Why global event handlers are being used instead of addEventListener for events? As far as I know, the benefits of the latter are pretty important:
- Can bind more than one function to the same event, which becomes more important for more advanced behavior + easier testing of such advanced use cases.
- Can be turned off
2 Answers
Eric Vandenberg
9,095 PointsI think he would agree. He mentions addEventListener in the last video ('Perfect') in the series Interactive Webpages with JavaScript.
Kevin Lozandier
Courses Plus Student 53,747 PointsAh, that's really good to know; I'm a bit confused why wait till then to introduce it. I'm in the last stage and was sort of concerned that was going to be untouched by the end of the series.