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 trialDonte' Poston
2,029 PointsI don't understand what i am doing wrong request assistance.
I watched the previous video 30 times I don't know the next step
var button;
var input;
var sayphrase = document.getElementByID('button');
sayPhrase.addEventListener('click', () => {
alert(input.value);
});
<!DOCTYPE html>
<html>
<head>
<title>Phrase Sayer</title>
</head>
<body>
<p><input type="text" id="phraseText"></p>
<p><button id="sayPhrase">Say Phrase</button></p>
<script src="js/app.js"></script>
</body>
</html>
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Donte' Poston! I'm guessing you've tried this several times so the instructions have gotten sort of muddled in the process. When learning to code, you should assume that everything (including file and folder names) are case-sensitive.
You typed:
document.getElementByID('button');
But the name of the method is getElementById()
. Note the lowercase "d" as opposed to the uppercase "D" that you've included. It makes a huge difference. Secondly, you are supposed to be doing this on the first line as the result is meant to be assigned to the var button
variable. Finally, the id you are meant to pick is "sayPhrase"
not 'button'
. I'm expecting to see this somewhere in your code: document.getElementById('sayPhrase');
Hope this helps!
Donte' Poston
2,029 PointsDonte' Poston
2,029 PointsThank you so much for the assistance it makes way more sense now, and I actually learned from what I done wrong.