Get the value of the next input
<pre><code>&lt;form method="post" id="formFinish2"&gt; 
    &lt;input type="checkbox" name="finish" /&gt; 
    &lt;input type="hidden" name="id" class="finishId" value="2" /&gt; 
&lt;/form&gt; 

&lt;script type="text/javascript"&gt; 
    $(":checkbox[name='finish']").click(function() { 
        id = $(this).closest('input.finishId').val(); 
        alert(id); 
        $("#formFinish".id).submit(); 
    }); 
&lt;/script&gt; 
</code></pre>

<p>Alerts me <code>undefined</code>. I would like it to alert me <code>2</code>, which is coming from the input that has the class <code>finishId</code>, next to the checkbox you clicked on.</p>
