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 trial

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

Mackewinsson Palencia
seal-mask
.a{fill-rule:evenodd;}techdegree
Mackewinsson Palencia
Full Stack JavaScript Techdegree Student 14,390 Points

This code test is not good. The preview is showing the right behavior but it says it's wrong. please help

This code test is not good. The preview is showing the right behavior but it says it's wrong. please help

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', function(event){
  $(event.target).hide(event.target);
});
Tommy Gebru
Tommy Gebru
30,164 Points

Try force-reloading your webpage Mackewinnson, your solution works well for me

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

Actually both solutions work for me

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

:smile:

1 Answer

Steven Parker
Steven Parker
231,275 Points

The error message contains a good clue: " Bummer: Within the anonymous function passed to the "on" method call, did you unintentionally supply arguments to the "hide" method call on the jQuery object with an argument of "event.target"? "

So for this challenge the "hide" call should not have an argument. In actual use, it can take either a duration or an options object argument. See the API page on .hide() for more details.