I got some problem when I want to develope checkall function using jquery.
I put all checkboxes in table to make it clear and would like to check all checkbox with value in input
.
For example, when I click the checkbox with value type1
, then all checkboxes value including type1
will be checked as well (type1, type1-1 and type 1-2).
HTML:
<table>
<tr class='type1'>
<td><input type="checkbox" value="type1"></td>
<td>Type_1<td>
</tr>
<tr class='type1-1'>
<td><input type="checkbox" value="type1-1"></td>
<td>Type_1-1<td>
</tr>
<tr class='type1-2'>
<td><input type="checkbox" value="type1-2"></td>
<td>Type_1-2<td>
</tr>
<tr class='type2'>
<td><input type="checkbox" value="type2"></td>
<td>Type_2<td>
</tr>
<tr class='type2-1'>
<td><input type="checkbox" value="type2-1"></td>
<td>Type_2-1<td>
</tr>
</table>
Is it possible to do it with jquery?
Thank you.
Aucun commentaire:
Enregistrer un commentaire