How to find closest form inbetween td <p>I have an odd situation. I need to have a form inbetween <code>td</code>s. I need this for some inrow updates that are ajax and only wish to submit a row in sections. So each row may have 2 or three forms.</p> <p>However, <code>$(this).closest</code> does not find this <code>form</code> -> <code>undefined</code>.<br> How best can I select this <code>form</code>?</p> <p>My <strong>html</strong></p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;form myid='hi'&gt; &lt;td&gt; &lt;a href="#"&gt;Delete&lt;/a&gt; &lt;/td&gt; &lt;/form&gt; &lt;/tr&gt; &lt;tr&gt; &lt;form myid='hi2'&gt; &lt;td&gt; &lt;a href="#"&gt;Delete&lt;/a&gt; &lt;/td&gt; &lt;/form&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>My <strong>jQuery</strong></p> <pre><code>$('a').click(function() { var val = $(this).closest('form').attr('myid'); alert(val); // undefined! return false; }); </code></pre> <p><a href="http://jsfiddle.net/tbc4G/3/" rel="nofollow">http://jsfiddle.net/tbc4G/3/</a></p>