JavaScript JavaScript and the DOM Getting a Handle on the DOM Selecting by Id

my code is not working

i put variable button but keep getting a message that i should recheck my code

js/app.js
let button;
let input;
let button=document.GetElementById("sayPhrase");
button.addEventListener('click', () => {
  alert(input.value);
});
index.html
<!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

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 83,234 Points

You've ever so slightly mistyped your method.

You want let button=document.getElementById("sayPhrase"); instead of let button=document.GetElementById("sayPhrase");.

You'll get there. Remember to check out the DOM documentation on the Mozilla network to get a handle on the various methods you can use to manipulate the DOM. :-)