JavaScript jQuery Basics Understanding jQuery Events and DOM Traversal Adding New Elements to the DOM

Why isnt my code working?

i dont see why this isnt working

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
</head>
<body>
    <h2>Student List</h2>

    <ul class="student-list">
        <li>James McAvoy</li>
        <li>Alena Holligan</li>
        <li>Wade Christensen</li>
        <li>Matt Krzyzynski</li>
    </ul>

    <script
    src="jquery-3.2.1.min.js"></script>
    <script src="app.js"></script>
</body>
</html>
app.js
var $newStudent = $('.student-list').append("<li>Sam Smith</li>");

1 Answer

Steven Parker
Steven Parker
173,603 Points

The second task wanted you to use the variable you created in the first task, but not change what it contains.

Start with what you had at the end of task 1, and then implement task 2 as a separate step on the following line.