tags:

views:

26

answers:

3

I have a disabled text input that loads as:

<input type="text" name="Email<%=i %>" disabled="disabled" />

I'd like the jQuery statement that enables it. Seems like:

$("email0").attr("enabled");

should be close but doesn't work.

+1  A: 

Use .removeAttr() like this:

$("input").removeAttr("disabled");

Or .attr() like this:

$("input").attr("disabled", false);
Nick Craver
+1  A: 

You can simply remove the disabled attribute:

$("input[name=email0]").removeAttr("disabled");

Note that the selector "email0" in your example will not match anything, you are looking for an input element that has a name attribute containing "email0".

CMS
+1  A: 
$("email0").attr("enabled");

… would get the value of the enabled attribute, which would be undefined since there isn't one.

You want:

$("email0").removeAttr("disabled");
David Dorward