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

There is a variable named input

Add an ID PhraseText

let button;
let input;
button = document.getElementById("sayPhrase");
input = document.getElementById('PhraseText');
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

Steven Parker
Steven Parker
194,132 Points

This code has "PhraseText" (with a capital "P"), but the instructions call for "phraseText" (with lower-case "p") to match the element that can be seen in the provided HTML code.