JavaScript jQuery Basics Understanding jQuery Events and DOM Traversal Events with jQuery

what am I doing wrong?

what am I doing wrong?

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
$('.student-list').on('click', event $(event.target).hide(); => {});

2 Answers

Dehn Hunsworth
Dehn Hunsworth
7,189 Points

Believe its your event listener, you have:

$('.student-list').on('click', event $(event.target).hide(); => {});

Think it should look more like this with the .hide method inside the callaback function:

$('.student-list').on('click', event  => {
   $(event.target).hide();
});

thanks dehn