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 trialJason Lewis
Full Stack JavaScript Techdegree Student 4,854 PointsSelect the second SPAN element on the page and assign it to the variable lastName on line 2. Take a look in the index.ht
Here is my complete code for both challenge questions:
var fullName = document.getElementById ("full_name"); var lastName = document.getElementByTagName("span")[1];
Not only does it tell me that is NOT Correct, its saying that the 1st code is "no longer passing".
Help Please!
2 Answers
Ken Alger
Treehouse TeacherJason;
Slight syntax error, it should be getElementsByTagName() not getElementByTagName() you are missing an "s".
Happy coding;
Ken
Jeesun Kim
4,866 PointsWhy is it wrong when I did:
```var lastName = document.getElementByClassName("last_name");
Ken Alger
Treehouse TeacherJeesun;
The challenge asked specifically to Select the second SPAN element on the page and assign it to the variable lastName
. In practice your code should work as well.
Ken
Jason Lewis
Full Stack JavaScript Techdegree Student 4,854 PointsJason Lewis
Full Stack JavaScript Techdegree Student 4,854 PointsThank you Ken!! That was the exact problem!!
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherSometimes it is the simplest things, isn't it? It can get exasperating looking for, what turns out to be, simple syntax mistakes.
Happy coding!