Why do I encapsulate a jQuery function within jQuery(function ($) { });
<p>I came across a piece of code which looks like this:</p>

<pre><code>jQuery(function($) {
  $('#saySomething').click(function() {
    alert('something');
  });
});
</code></pre>

<p>I don't quite get it. Why can't I simply do this:</p>

<pre><code>$('#saySomething').click(function() {
   alert('saySomething');
});
</code></pre>
