How to maiantain checkbox state under onclick of javascript...checkbox losing its state under onclick of javascript...Onchange when set works in firefox but not in chrome and IE...Onclick works but checked state gone...
Collapse | Copy Code
<script type="text/javascript">
function salaryshowhide() {
var lfckv = document.getElementById("<%=chksal.ClientID%>").checked;
if (lfckv== true) {
document.getElementById("<%=txtsal1.ClientID%>").disabled = false;
document.getElementById("<%=txtsal2.ClientID%>").disabled = false;
document.getElementById("<%=currency.ClientID%>").disabled = false;
document.getElementById("<%=permonth.ClientID%>").disabled = false;
document.getElementById("<%=chksal.ClientID%>").checked = true;
alert("a");
}
else {
document.getElementById("<%=txtsal1.ClientID%>").disabled = true;
document.getElementById("<%=txtsal2.ClientID%>").disabled = true;
document.getElementById("<%=currency.ClientID%>").disabled = true;
document.getElementById("<%=permonth.ClientID%>").disabled = true;
document.getElementById("<%=chksal.ClientID%>").checked = false;
}
return false;
}
</script>
<asp:CheckBox ID="chksal" runat="server" style="float:left" onclick="return salaryshowhide();"
/>