Why do I keep getting it wrong?


#1

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

Here's my code! Why do I keep getting it wrong? I tried placing my var outside the "{ }" but that didn't work either


3 variable target
#2

White space could be part of the issue, but the more glaring mistake is the # in (#4).

$('ol li:nth-child(4)')

#3

Thanks! That did the trick! Don't really understand why the "#" has to go away?


#4

The only places we use # are in the style sheet to indicate an ID selector, or in a URL to indicate a page fragment which element has an ID attribute.


#5

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