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 trialilyass mougar
Courses Plus Student 2,858 PointsChallenge task 1 of 2
Challenge task 1 of 2 Select the H1 tag with the id of full_name and assign it to the variable fullName on line 1. Take a look in the index.html to see the structure of the document code app.js
var fullName; var lastName;
index.html
<!DOCTYPE html> <html> <head></head> <body> <h1 id="full_name"><span class="first_name">Andrew</span> <span class="last_name">Chalkley</span></h1>
<script src="app.js"></script> </body> </html>
6 Answers
Trong Nguyen
10,286 PointsHere is my answer. var fullName=document.getElementById("full_name"); var lastName=document.getElementsByClassName("last_name");
Marcin Robert Kaźmierczak
33,570 PointsIt should be
var fullName=document.getElementById("full_name");
var lastName=document.getElementsByTagName("span")[1];
Erik McClintock
45,783 PointsIlyass,
Could you please post your code and the problem that you're having?
Erik
ilyass mougar
Courses Plus Student 2,858 PointsErick, can you give me the solution of this chalenge The chalenge is say Select the H1 tag with the id of full_name and assign it to the variable fullName on line 1. Take a look in the index.html to see the structure of the document
the code of app.js
<p>var fullName;
var lastName;
</p>
```
and the code of index.html
```html
<p>
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1 id="full_name"><span class="first_name">Andrew</span> <span class="last_name">Chalkley</span></h1>
<script src="app.js"></script>
</body>
</html>
</p>
Erik McClintock
45,783 PointsIlyass,
I would be more than happy to help guide you towards the answer if you could provide the code that you've tried and what specifically you're stuck on regarding this challenge!
Erik
Michael Stopa
14,965 PointsDear All, It looks like the second task is not passing. Any idea whay it might be?: var fullName=document.getElementById("full_name"); var lastName=document.getElementsByClassName("last_name");
Best, M
Lindsay Cardiff
9,833 Pointsvar fullName=document.getElementById("full_name"); var lastName=document.getElementsByClassName("last_name");
ilyass mougar
Courses Plus Student 2,858 Pointsilyass mougar
Courses Plus Student 2,858 PointsThx and this Select the second SPAN element on the page and assign it to the variable lastName on line 2. Take a look in the index.html to see the structure of the document.