title: jQuery simulate click
body: <p>I want to trigger a function when the page is loaded. <a href="https://stackoverflow.com/questions/890090/jquery-call-function-after-load">There are many ways to do this.</a>
  However, when I add <code>$('#button').click</code> in front of my function, then the <code>getType</code> function is not recognized. For example:</p>
  
  <pre><code>$('#button').click(function getType(id) {
      //...some code
  });
  </code></pre>
  
  <blockquote>
    <p>error: getType is not defined</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <p>Just to clarify, in this case I cannot use an anonymous function. Also, it does not matter to me whether I use <code>$(document).ready</code> or <code>$(window).bind("load", function()</code>, but using these I still get the “getType is not defined” error.</p>