title: How does jquery know which function to run?
body: <p>I have:</p>
  
  <pre><code>&lt;script&gt;
      $(function() {
          $( "#datepicker" ).datepicker();
      });
  &lt;/script&gt;
  
  &lt;div class="demo"&gt;
  &lt;p&gt;Date: &lt;input id="datepicker" type="text"&gt;&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I click in the datepicker box the datepicker appears, as expected.</p>
  
  <p>Question: How does jquery know to run that function when I click on the box and not another function?  </p>
  
  <p>If I want to add a function for something else, how would jquery know which to refer to?  </p>
  
  <p>I am used to using php where all functions have a name and you refer to them by the name...</p>