Stuck in jQuery Functions and Selectors Lesson 3: Variables


#1

I barely started the variables lesson and it is very confusing. Can some one tell me what is wrong with my code?

script.js

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


#2

We target or even assign values to a jquery variable using the $ sign...and don't declare a variable simply using $, we do this in php....add a var keyword while using javascript/jquery

// Write your jQuery code on line 3!
$(document).ready(function() {
    var $target = $("li:nth-child(4)")
    $target.fadeOut('fast');
});

#3

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