What's Wrong With This Code


#1



https://www.codecademy.com/courses/web-beginner-en-GfjC6/0/3?curriculum_id=50a3fad8c7a770b5fd0007a1#


Error message says "Did you target the 4th li child of the ordered list?"


  $(document).ready(function() {
    var $target = $('li: nth-child(4)');
    $target.fadeOut('fast');
});


The code above is the jQuery that I edited to add line two (as instructed). The html that it connects to is entirely the same as it was when I started the exercise, as it says nothing in the exercise about changing the html. It works fine if I give the li in question a class of "wrong" and change "li: nth-child(4)" to "#wrong" and while it does make the code work and it does allow me to move on, the first one should also work, and the first one is what the exercise says to do.


#2

You've got to use this $('ol, li:nth-child(4)'); since your targeting the list element in an ordered list. Hope this helps!


#3

I checked. That just deletes the whole list and (assuming that 'li: nth-child(4)' is correct) also tries to delete the last list item under that list.


#4

Oh lol it let me pass with the wrong code. Remove the space between the colon and nth in li: nth-child