How do I bind an event handler to the "change" JavaScript event, or trigger that event on an element?
<p>I do not understand how to get change event to call a function.</p>

<pre><code>$(function () {

  function foo() {
    alert("ok");
  }

  //works
  $('#myElement').change(function() {
    alert("ok");
  });

  //does not work
  $('#myElement').change(foo);

  //does not work
  $('#myElement').change(foo());
}
</code></pre>
