Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChase Nobles
Full Stack JavaScript Techdegree Student 13,633 PointsNot sure why this isn't working. The question is pretty confusing..
Wondering how to get this to work. The question is pretty confusing.
<!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>
$('.student-list').on('click', 'ul', function(event) {
});
2 Answers
Steven Parker
231,261 PointsThough this might be a good situation to use it, the instructions did not ask for descendant filtering, so you won't need that 2nd argument ('ul').
Abhay Mishra
Courses Plus Student 37 PointsHi,
We need to modify code.
$('document').on('click', 'ul.student-list', function(event) { console.log("Option 1") });
or
$('ul.student-list').on('click', function(event) { console.log("Option 2") });
Both option will work
Steven Parker
231,261 PointsFYI: The first suggestion shown here does not follow the instructions, and will not pass the challenge.
Abhay Mishra
Courses Plus Student 37 PointsAbhay Mishra
Courses Plus Student 37 PointsAnd what about 2nd option?
Steven Parker
231,261 PointsSteven Parker
231,261 PointsThat's the same as Chase's code with the 2nd argument removed, except you also added the tag name to the class selector. That works, and is perhaps more literally correct for the instructions, but it's not needed to pass the challenge.