title: Failing to trigger the onChange event
body: <p>I've got this piece of code, to search the contents of HTML elements with the class "widget" and use the jQuery functions <code>fadeIn()</code> and <code>fadeOut()</code> to only show elements that match the search term. I don't know how to assign the search function to, because I don't assign it to the search box's change event. What is the equal of <code>onchange=</code> in jQuery? My current code:</p>
  
  <pre><code>function search(text, elements) {
      var term = text.value.toLowerCase();
      var elms = $(elements);
      var elm;
      for (var i = elms.length; i &gt; 0; i-=1){
          elm = elms.get(i);
          if (elm.text().toLowerCase().indexOf(term)&gt;=0 ) {
              elm.fadeOut(500);
          } else {
              elm.fadeIn(500);
          }
  
      }
  }
  </code></pre>
  
  <p>And the failing inline script to trigger the onchange:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function() {
      $("#search").change(function() {
              search($("#search").text(),".widget");
          });
      });
  </code></pre>
  
  <p></p>