Why doesn't this work? • 3/13 - jQuery Functions and Selectors


#1
<!DOCTYPE html>
<html>
	<head>
		<title>Simplify, Simplify</title>
        <script type='text/javascript' src='script.js'></script>
	</head>
	<body>
        <div> Remember!
            <ul>
                <li>
                    <ol>
                        <li>Start with the function keyword</li>
                        <li>Inputs go between ()</li>
                        <li>Actions go between {}</li>
                        <li><span id="chumps">jQuery is for chumps!</span></li>

                    </ol>
                </li>
                <li>Inputs are separated by commas.</li>
                <li>Inputs can include other functions!</li>
            </ul>
        </div>   
	</body>
</html>

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


#2

It works fine in a real web page or a less limited environment, but here you're limited by Codecademy's parser. Even if it's correct, It might not accept an answer that isn't submitted in exactly the expected way.

Here's your code working at Codepen: http://codepen.io/Ghodmode/pen/rxaXBW


#3

Ok thank you! Much appreciated.


#4

@malmn,

The course-checker: Did you target the 4th li child of the ordered list?
So you would have to use

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

google search
== the Book ==
nth-child() site:jquery.com