Why do I keep getting it wrong?


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

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

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

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


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


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.


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