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

josephweiss2
josephweiss2
7,094 Points

addEventListener

Hi im trying to use the addEventListener in chrome but it dose not work, only if i put like this: document.addEventListener.... but if i select a button or id or class or element it dose not work, what do i do wrong?

Michael Cook
Michael Cook
2,125 Points

This question isn't answerable without being able to view your code. Can you post your code?

1 Answer

josephweiss2
josephweiss2
7,094 Points

Thanks for answering, i just realised now that i need to input the js file at the end of the html and not on the beginning. so now its fixed, thanks very much