Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Interactive Web Pages with JavaScript Selecting Elements and Adding Events with JavaScript Selecting Elements

How does second answer break first response?

The first task passes. Then the second task seems to break the first task. What is going on here?

Oops! It looks like Task 1 is no longer passing.
app.js index.html

1 var fullName = document.getElementById("full_name");

2 var lastName = document.getElementsByTagname('span')[1];

3 Answers

Sante Kotturi
Sante Kotturi
7,434 Points

I believe it's not really breaking the first, but you're missing a capital N :)

document.getElementsByTagName('span')[1];

instead of:

document.getElementsByTagname('span')[1];

Does that fix it?

I can't believe I stared at that for an hour and didn't see that. Thank you. All is good now!

Sante Kotturi
Sante Kotturi
7,434 Points

I'm right there with you, done that MANY TIMES! What I recommend doing is using code complete, it will help a lot. Depending on what browser you're using the steps will be slightly different but I'm on a mac using chrome. You want to open up the developer tools (chrome, firefox and safari have one) panel (for me its command + option + J) Make sure you're in the Console, not the Elements view and then you can begin typing. In this case if you started typing doc.. it would suggest "document", press TAB, then ".getEle...." and as you continue typing it will suggest all the .getElementBy... methods. Sure enough .getElementByTagName is one of the options. That's the only way I knew it was a capital N....

Hope that helps prevent future hours of hair pulling :D

Thanks!