I have checkbox and option to check/uncheck using an Edit option and Cancel option.Issue is that when I uncheck a previously checked value or vise versa and hit cancel event the checkbox does not retain its original value(checked) and shows unchecked. I want that on click of cancel, the checkbox should show original value. here is my javascript code:
function Cancel(Login, ID, IsBlock) {
debugger;
$("#chk" + ID).val(IsBlock);
$("#chk" + ID).prop("disabled", true);
document.getElementById("Edit " + ID).style.display = 'block';
document.getElementById("Update " + ID).style.display = 'none';
document.getElementById("Cancel " + ID).style.display = 'none';
}
and here is my html
<a href="javascript:void(0);" id='Edit @Model[i].ID' onclick="Edit(@Model[i].ID)">Edit</a>
<a href="javascript:void(0);" id='Update @Model[i].ID' onclick="Update('@Model[i].Login','@Model[i].ID')" style="display:none">
Update</a> <a href="javascript:void(0);" id='Cancel @Model[i].ID' onclick="Cancel('@Model[i].Login','@Model[i].ID','@Model[i].IsBlock')" style="display:none">
Cancel</a>
Aucun commentaire:
Enregistrer un commentaire