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

Nicholas Wallen
Nicholas Wallen
12,278 Points

No idea why this isn't working. My answer is correct.

let input = document.getElementById("phraseText");

That is the correct answer. Its not working.

let input = document.getElementbyId('phraseText');
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

trio interactive
trio interactive
15,325 Points


You seem to have misspelled the getElementById in the first line (lowercase b should be capital B). Otherwise your code is passing.

Nicholas Wallen
Nicholas Wallen
12,278 Points

How come it requires "console.log(button); " That wasn't discussed in the videos.

Antti Lylander
Antti Lylander
9,660 Points

No, it certainly does not require console.log to pass.