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

let button;
let input;
let button=document.GetElementById("sayPhrase");
button.addEventListener('click', () => {
<!DOCTYPE html>
    <title>Phrase Sayer</title>
    <p><input type="text" id="phraseText"></p>
    <p><button id="sayPhrase">Say Phrase</button></p>
    <script src="js/app.js"></script>

1 Answer

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 89,651 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. :-)