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 trialSaqib Ishfaq
13,912 Pointsmy code doesnt work for changing description for list items ! even tho my code exactly as been taught in the video! help
its not working even when i use "p.innerHTML" instead of "p.textContent" whats wrong with the code? https://w.trhou.se/c71pmaxdr3
1 Answer
Bernardo Bonança
10,773 PointsIt seems your EventListener is not setup quite right.
Instead of doing:
button.addEventListener = ('click', () => {
p.textContent = input.value + ':';
});
You want to do:
button.addEventListener('click', () => {
p.textContent = input.value + ':';
});
This way you are calling the addEventListener method on your button element and passing in the necessary arguments: "click", your event name, and your callback function, called when the event is triggered.
Saqib Ishfaq
13,912 PointsSaqib Ishfaq
13,912 PointsThanks alot! wud u believe i spent like more than an hour tryna firgure out wot the prob was ! (facepalm)