JavaScript JavaScript and the DOM Making Changes to the DOM Removing an Element from the DOM

Azzie Fuzzie
Azzie Fuzzie
6,537 Points

Select elements

What am I doing wrong?

app.js
var myList = document.querySelector('ul') ;
var firstListItem = document.querySelector('lifirst');
index.html
<!DOCTYPE html>
<html>
    <head>
        <title>DOM Manipulation</title>
    </head>
    <link rel="stylesheet" href="style.css" />
    <body>
        <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>

1 Answer

Shaun Kelly
Shaun Kelly
33,485 Points

Hi Azzie,

You're missing the ID selector which is the hash symbol. It should look as follows:

var myList = document.querySelector('ul') ;
var firstListItem = document.querySelector('li#first');

Hope this helps, Shaun