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

karunaraina
karunaraina
1,352 Points

In app.js, use jQuery to create a new <li> element containing the student name "Sam Smith", and save your new element to

help

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
const $newStudent = '<li> Sam Smith </li>'
$('.student-list').append($newStudent)

1 Answer

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 45,161 Points

Review this video @ :30 and you will see you are missing something in how you created $newStudent. I would also remove the extra spaces around Sam Smith. Sometimes the checker can be finicky about text.