
Announcement
Collapse
No announcement yet.
disabled="true" and disabled="false" is same!why
Collapse
X
-
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)Last edited by glenngv; Feb 11, 2004, 04:03 AM.
-
I believe the W3C recommends you use disabled="disabled" for clarity in these situations.Last edited by Roy Sinclair; Feb 11, 2004, 12:37 PM.Check out the Forum Search. It's the short path to getting great results from this forum.
Comment
-
Yes. I was just pointing out that any value (or no value at all) of the disabled attribute, the browser will render it disabled.
Comment
Comment