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 trialClifford Angat
72 PointsBummer: There was an error with your code: TypeError: 'undefined' is not a function (evaluating 'document.GetElementById
Bummer: There was an error with your code: TypeError: 'undefined' is not a function (evaluating 'document.GetElementById('myTextInput')')
var button = document.getElementById('sayPhrase');
var phraseText = document.GetElementById('myTextInput');
button.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>
2 Answers
KRIS NIKOLAISEN
54,972 PointsTask 2 instructions: Next, select the input element with the ID phraseText and assign it to the input variable.
You have a few issues:
- you changed the variable name from
input
tophraseText
- the g in
getElementById
should be lowercase - the id to select is
phraseText
notmyTextInput
Didier Pham
7,175 Pointswhat is the goal of select the input element with the ID phraseText and assign it to the input variable. Guil talks a lot in the videos but when the exercices come i dont know what to do because they look different from what i saw..