mercredi 24 juin 2015

check uncheck using jquery in MVC is not working [duplicate]

This question already has an answer here:

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