What's Wrong With This Code



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

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

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.


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


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.


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