JavaScript jQuery Basics Working with jQuery Collections The .each() method

Syntax problem?

I'm so, lost....am I making a syntax error?

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <h2>My Favorite Things</h2>

    <ul class="favorite-things">
        <li>Kittens</li>
        <li>Rainbows</li>
        <li>Unicorns</li>
        <li>Sprinkles</li>
    </ul>

    <script
    src="jquery-3.2.1.min.js"></script>
    <script src="app.js"></script>
</body>
</html>
app.js
$('.favorite-things li').each(function() {
 $(this).prepend('<input type="checkbox"/>'); });
});

1 Answer

Steven Parker
Steven Parker
173,506 Points

You replicated the closing brace of the function, and the closing parenthesis (and semicolon) of the "each" call.

All of those were already provided by the challenge on the next line.