title: Jquery closest not working
body: <p>I've trying for a while to now to figure out why I can never get the "closest" function from jquery to work.</p>
  
  <p>Say I have this code;</p>
  
  <pre><code>&lt;form&gt;
  &lt;input type='text' name='q'&gt;
  &lt;a href='javascript:void(0);' id='search_items'&gt;Search&lt;/a&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Why does the following always alert "undefined"?</p>
  
  <pre><code>$("#search_items").bind('click', function () {
      var q = $(this).closest("input[name=q]").val();
      alert(q);
  });
  </code></pre>
  
  <p>Thanks in advance!
  Cheers,
  Ben</p>