Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript and the DOM (Retiring) Getting a Handle on the DOM Selecting by Id

matthew pullen
matthew pullen
2,410 Points

I keep getting errors in tests that Task 1 is no longer passing when doing tests

Task 1 was setting button let button = document.getElementById('sayPhrase'); (This code passed ok)

Task 2 was setting input as well let button = document.getElementById('sayPhrase'); let input = document.getElementByid('phraseText'); (This now says task 1 is not passing)

I am confused... What am I doing wrong?

js/app.js
let button = document.getElementById('sayPhrase');
let input = document.getElementByid('phraseText');

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>

2 Answers

Brodey Newman
Brodey Newman
10,962 Points

Hey Matthew,

Looking at your code I see you didn't capitalize the 'I' in:

document.getElementByid('phraseText');

Do that and it should work.

Hope this helps :)

matthew pullen
matthew pullen
2,410 Points

Thanks Brody... I guess when I retyped I got it right. Thanks for taking a look though;-)

matthew pullen
matthew pullen
2,410 Points

I deleted everything and retyped it for the second task and it worked. Looks like something is changing in the test window from one task to another... I am going to contact support.

M.