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 trialBrian CI
28,971 PointsWhy doesn't the text input box change?
I get the console logs but the text input box does not change for me. What's wrong?
var button = document.getElementById('action');
var input = document.getElementById('text_field');
button.addEventListener('click', function () {
console.log('clicked');
});
button.addEventListener('click', function () {
console.log('Other click');
input.setAttribute('value', 'Hello World');
});
1 Answer
Adam Sackfield
Courses Plus Student 19,663 PointsSeems to work. See this pen
Brian CI
28,971 PointsBrian CI
28,971 PointsStrange, works for me now too. Maybe my browser just needed to be reloaded. Thanks.
Adam Sackfield
Courses Plus Student 19,663 PointsAdam Sackfield
Courses Plus Student 19,663 PointsNo worries. Usually the case if you expect something to work its either a typo or the browser needs a refresh :)