title: Differences between document.ready and $function
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://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="https://stackoverflow.com/questions/7307509/jquery-choosing-a-document-ready-method">jquery: Choosing a document.ready method</a>  </p>
  </blockquote>
  
  
  
  <p>What is the difference between doing this</p>
  
  <pre><code>$(function() {
      $("a").click(function(event){
          alert("Thanks for visiting!");
      });
  });
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>$(document).ready(function(){
      $("a").click(function(event){
          alert("Thanks for visiting!");
      });
  });
  </code></pre>