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

How do I add value reference Id

The quiz is asking add value reference button Id sayphrase and when set it say there null problem with your addeventlistner. I don't understand how

js/app.js
let button = document.getElementById('sayPharse');
let input;

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

tomd
tomd
14,686 Points

You have misspelt 'sayPhrase'