Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
221,976 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.