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

Tried everything

Nothing is going right here.

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
$('li').eq(2).prev('li').prev('li');
$('li').eq(2).prev().prev();

1 Answer

Your second line of code is the correct solution. If you remove the first line it will pass the challenge.

$('li').eq(2).prev().prev();