...

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



tvbas
02-11-2004, 07:20 AM
:confused:

glenngv
02-11-2004, 07: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, 04:07 PM
I believe the W3C recommends you use disabled="disabled" for clarity in these situations.

glenngv
02-12-2004, 01: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum