how to enable and disable a textbox in jQuery in ASP.net

asp.net, c#, jquery

Solution

`enabled` is not a valid attribute for `textbox`es. So the following will have no effect:

$('#<%=txtBQty.ClientID %>').attr("enabled", "enabled");

Instead use

$('#<%=txtBQty.ClientID %>').removeAttr("disabled");

Problem

I have a Textbox where I need to disable or enable that on some Conditions. ``` var stat = "any interger" if (statId != 1) { $('#<%=txt1.ClientID %>').attr("disabled", "disabled"); } else { $('#<%=txtBQty.ClientID %>').attr("enabled", "enabled"); } ``` This one will work but after disable if the condition returns false also means It won't enable the textbox.

Original source