Possible Duplicate:
Get a list of all checked values
I have a form with a series of checkboxes all, none or various of which can be checked.
<p><label for="available_lengths">Rail Length:</label></p>
<p>
<ul>
<li><label for="id_available_lengths_0"><input name="available_lengths" value="132" id="id_available_lengths_0" type="checkbox" class="can_update_lengths" /> 132</label></li>
<li><label for="id_available_lengths_1"><input name="available_lengths" value="168" id="id_available_lengths_1" type="checkbox" class="can_update_lengths" /> 168</label></li>
<li><label for="id_available_lengths_2"><input name="available_lengths" value="208" id="id_available_lengths_2" type="checkbox" class="can_update_lengths" /> 208</label></li>
<li><label for="id_available_lengths_3"><input name="available_lengths" value="240" id="id_available_lengths_3" type="checkbox" class="can_update_lengths" /> 240</label></li>
</ul>
</p>
How do I loop through these and assign a variable the .val()
of each?