This question already has an answer here:
I have this code whereby in a table row there are checkboxes and input boxes, I would like to get the values of all input boxes whose checkboxes are checked
This is the html
<table>
<tr>
<td><input type="checkbox" name="new" value="37"></td>
<td><input type="text" name="new" id="quantity" class="37"></td>
</tr>
<tr>
<td><input type="checkbox" name="new" value="38"></td>
<td><input type="text" name="new" id="quantity" class="38"></td>
</tr>
.....#this continue
</table>
Note that the class of the input boxes is the same as the value of checkboxes
Currently am using this code to check all the checked checkboxes
var marked = new Array();
var k = 0;
$('input:checked').each(function(index,value) {
marked[k] = value;
k++;
alert(k);
});
alert($('input[name="new"]:checked').serialize());
How can i change it to return the value of the input boxes
Aucun commentaire:
Enregistrer un commentaire