Given the following table structure, how would I get all the input vals within a table when the .button is clicked?
<table>
<tr>
<td><input value="1" name="A" type="text" /><td>
</tr>
<tr>
<td><input value="2" name="B" type="text" /><td>
</tr>
<tr>
<td><input value="3" name="C" type="text" /><td>
</tr>
<tr>
<td><div class="button"></div><td>
</tr>
</table>
This is the jquery I have so far:
$('.button').click(function() {
alert($(this).parent('table').('input').serialize());
});
The function isn’t working though, it’s not finding the input in the table I guess…
tableis not the parent of the button,tdis… try :$(this).closest('table').find('input').serialize()