Targeting elements by CSS selector

Fading out a div on document ready by targeting it using CSS selectors. Source: http://www.codecademy.com

by clarusdignus

HTML

<div></div>
<div id="green"></div>

CSS

div {
    height:100px;
    width:100px;
    background-color:#FF0000;
    border-radius:5px;
    margin-bottom:5px;
}

#green {
    background-color:#008800;
}

JavaScript

$(document).ready(function() {
    $("#green").fadeOut(1000);
});