jQuery Functions and Selectors - Variables


#1

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

No idea what I am doing wrong here.

To pass this I thought I would use pseudo-class selectors but nope still giving me this error.
I have also tried creating a new ID and assigning $target to that ID but still not working.

Oops, try again. Did you target the 4th li child of the ordered list? Check the Hint if you need help.

Not sure why this simple exercise is messing me up so much.

// Write your jQuery code on line 3!
$(document).ready(function() {
    
    $target.fadeOut('fast');
});

var $target = $('ol li:nth-child(4)');

I have also tried multiple browsers.


#2

$target is not declared within document ready, so the code never executes


#3

You are so right. And how did I not even read the comment. That makes complete sense just like a normal JS function. Sometimes man I question myself. Ty tho @stetim94 you the best.


#4

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