Is $(function() { }) an exact equivalent to $(document).ready(function() { })
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2662778/what-is-the-difference-between-these-jquery-ready-functions">What is the difference between these jQuery ready functions?</a><br>
  <a href="http://stackoverflow.com/questions/4384651/are-function-and-document-readyfunction-the-same">Are $(function(){}); and $(&ldquo;document&rdquo;).ready(function(){}); the same?</a><br>
  <a href="http://stackoverflow.com/questions/12008843/start-javascript-code-with-function-etc">start javascript code with $(function, etc</a>  </p>
</blockquote>



<p>Today, while reviewing some javascript code I found that some portions of code where written in a <code>$(function() { })</code> section, and other part of code where inside a <code>$(document).ready(function() { })</code> one. So my first reaction was: OK, What's the difference?</p>

<p>After a little of googling I found the next statement in the jQuery tutorial <a href="http://docs.jquery.com/Tutorials%3aGetting_Started_with_jQuery" rel="nofollow">Getting Started with jQuery</a>:</p>

<blockquote>
  <p>The following is a shortcut for the $(document).ready(callback) notation:</p>
</blockquote>

<pre><code>$(function() {
    // code to execute when the DOM is ready
});
</code></pre>

<p>Now, the question is: Is <code>$(function() { })</code> an exact equivalent to <code>$(document).ready(function() { })</code>?</p>

<p>(And also a "less-global" indirect question will be: Is safe for me to put all the code in just one of the two sections?)</p>
