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 trialMike John
3,182 PointsWhat mistake am I doing in this code challenge.?
What mistake am I doing in this code challenge.?
<!DOCTYPE html>
<html>
<head>
<title>DOM Manipulation</title>
</head>
<link rel="stylesheet" href="style.css" />
<body>
<ul id= "ul">
<li id="first">First Item</li>
<li id="second">Second Item</li>
<li id="third">Third Item</li>
</ul>
<script src="app.js"></script>
</body>
</html>
let myList = input.value('ul');
let firstListItem;
3 Answers
paulscanlon
Courses Plus Student 26,735 PointsHi Mike
Assuming you are on the first challenge Try this
let myList = document.querySelector("ul");
This selects the element and stores it in the variable, not the value.
Hope this helps. Happy coding
Paul
Brice Roberts
22,415 PointsI am assuming that this is for step #1??
If so, input.value is not correct.
input.value is to reflect a value that you want to set once you have instantiated it's location..
For this step, you have to reference the list location in the DOM.
If that doesn't make sense.. pause the previous video around the 1:30 mark, and compare what you have tried to the example.
HINT: you need to get the field by it's tag
Rupa Ramraj
3,089 PointsStill cannot figure out, what is the mistake with above step 3 in the challenge. Can someone post solution please?
Mike John
3,182 PointsTry:
myList.removeChild('#first');
Mike John
3,182 PointsMike John
3,182 PointsWhat mistake am I doing in the last step of this challenge :
Calin Bogdan
14,921 PointsCalin Bogdan
14,921 PointsThe last task of the challenge is:
Remove the list item element stored in firstListItem from the DOM
You're currently trying to remove the firstListItem from itself, which can't work. You have to remove the element stored in the firstListItem variable from the list element stored in the myList variable.
Hope it helped!