Hello all I have a table as follows
function checkAll2(rowClass, status) {
var dynamicClass = $('.' + rowClass);
// alert($('.1').find(":checkbox").length);
alert($('input:checkbox.1').length);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id="table1">
<tr>
<td>1a:</td>
<td><input type="checkbox" name="selected" value="1a" class="1"></td>
</tr>
<tr>
<td>1b:
</td>
<td><input type="checkbox" name="selected" value="1b" class="1"></td>
</tr>
</table>
Select All/None above<input type="checkbox" onclick="checkAll2(1,this.checked)" />
But what I need is I would like to reuse this for different classes too so I will pass rowClass
so that my input:checkbox
should be appended with rowClass
and give me the count or the list of controls with that class
Aucun commentaire:
Enregistrer un commentaire