is it possible to checked only the checkbox which belongs to a row in a table inside blade template using jquery? i have this table view
i want to checked only the students belongs to 7-A without including the student in 7-B how do i make it work? i'm using for-each loop to display the data in my table. With my current jquery code it will check all the item inside the table.
View Table:
<table class="table table-hover table-bordered" >
<tr>
<th>Section</th>
<th>Student</th>
</tr>
@foreach($sections as $section)
<tr>
<td>
<input type="checkbox" id="chckHead" />
<label> <label>
</td>
<td>
@foreach($section->lead as $bt)
<input type="checkbox" class="chcktbl" name="lead_id[]" value="">
<label ></label>
@endforeach
</td>
</tr>
@endforeach
</table>
Script
<script type="text/javascript">
$('#chckHead').click(function () {
if (this.checked == false) {
$('.chcktbl:checked').attr('checked', false);
}
else {
$('.chcktbl:not(:checked)').attr('checked', true);
}
});
$('#chckHead').click(function () {
});
Aucun commentaire:
Enregistrer un commentaire