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

True Andrews
True Andrews
Front End Web Development Techdegree Student 9,045 Points

What am I missing with this code?

What do I need to add to this?

<!DOCTYPE html>
<html lang="en">
    <h2>Student List</h2>

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

    <script src="app.js"></script>
$('.student-list').on('click', function({

1 Answer

Emmanuel C
Emmanuel C
8,760 Points

Hey Andrew,

Its actually what you need to remove from your code to make a it work.

First, the call back function for the on() method takes the whole 'event' object, not just the ''

Second, the jquery in the callback function is selecting as a string instead of as the variable. Simply remove the quotes an you'll be good.