Variables - nth-child not working


Link for exercise:

I was unable to figure out the correct code and after reading serveral forum posts I still cannot get the code to work properly. Is there anyway this course can be transferred into the format the "Learn" courses are so the code is shown after a few wrong attempts instead of having to staff and continuously answer the same questions?


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

Replace this line with your code.


first you fade out the target, then you define what the target is? Shouldn't this be the other way around? How can you fadeOut a target if you don't know what the target is

codecademy even shows this below the output window


Hi stetim94 - thanks for the quick reply. I reordered and I can now move on.

Looking at the code logically rather than by function it makes sense that I need to define the target first before the fade. Are there any other instances or cases in which the functions need to go before variables or other items?


logic and programming is closely related. Your code always needs to be logic :stuck_out_tongue:


Hi stetim94 - understand now just jQuery is very different to me than the HTML and JS classes I took. Also are you saying all variables will always go above the functions just like in HTML and JS? Thanks!


$target is just a variable, of course you need to define a variable before you can use it


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.