View Full Version : disabled="true" and disabled="false" is same!why

02-11-2004, 08:20 AM

02-11-2004, 08:56 AM
Because the disabled attribute can accept any value.
As long as this attribute is present, the element will be disabled regardless of its value.

<input type="text" value="This is disabled" disabled>
<input type="text" value="This is disabled" disabled="disabled">
<input type="text" value="This is disabled" disabled="true">
<input type="text" value="This is disabled" disabled="false">

<input type="text" value="This is not disabled">

Although in scripting, it is different.

document.formname.elementname.disabled = true; //disabled
document.formname.elementname.disabled = false; //enabled

The same is true for these attributes:
checked (radio button and checkbox)
selected (option)
nowrap (td)

Roy Sinclair
02-11-2004, 05:07 PM
I believe the W3C recommends you use disabled="disabled" for clarity in these situations.

02-12-2004, 02:20 AM
Yes. I was just pointing out that any value (or no value at all) of the disabled attribute, the browser will render it disabled.