This question already has an answer here:
- .prop() vs .attr() 11 answers
Header checkbox as
<th>
<input id="chkAll" type="checkbox" />
</th>
Child checkboxes code
<td>
<input id="employeeIdsToDelete" type="checkbox" name="employeeIdsToDelete" value="@Model.Id" />
</td>
Jquery code as:
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function () {
$("#chkAll").click(function () {
$("input:checkbox[name=employeeIdsToDelete]").attr("checked",this.checked);
});
});
</script>
when first click header checkbox it is working but when again click on header checkkbox is not working. when page refreshed it working but one time only
Aucun commentaire:
Enregistrer un commentaire