Difference between $(document).ready and writing open jQuery statements
<p>What is the difference between writing code with and without <code>$(document).ready</code>?</p>

<p>For example:</p>

<pre><code>$(document).ready(function() {
    $("#button").click(function() {
        //Code
    });
});
</code></pre>

<p>And:</p>

<pre><code>$("#button").click(function() {
    //Code
});
</code></pre>

<p>And :</p>

<pre><code> &lt;input id="button" type="button" value="Cancel" onclick="hidedropdown()" /&gt;

    function hidedropdown() {
        //Code
}
</code></pre>
