I want to disable & enable a textbox with check /uncheck event of a checkbox using Jquery. The following code is not working for me. Am I missing anything?
Should I use onclick event or oncheck event of checkbox???
NB: I put alert statements & found that, if block alert is getting called multiple times, but else part is not getting called even a single time.
My CSHTML has : @Html.CheckBox("chkprivate", new { @onclick = "Private_Checked();" })
My JS code has :
function Private_Checked() {
$("#chkprivate").click(function () {
// if ($('#chkprivate').attr("Checked") == true) {
if ($('#chkprivate').is(':checked')) {
{ $('#Customer_Name_Ext').attr("disabled", "disabled"); }
}
else {
{ $('#Customer_Name_Ext').removeAttr("disabled"); }
}
});
}