Why wrap code into 'document ready'
<p>I'm new to Jquery. See an example at <a href="http://w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_p" rel="nofollow">http://w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_p</a>. Here, clicking 'Click Me' button the text change. My question is why the following code need to wrapped under <code>$(document).ready(function(){ )}</code>. Otherwise, it doesn't work.</p>

<p>Thanks so much for all your help and really appreciate.</p>

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