Web Analytics Made Easy -
StatCounter disabled="true" and disabled="false" is same!why - CodingForum

Announcement

Collapse
No announcement yet.

disabled="true" and disabled="false" is same!why

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • disabled="true" and disabled="false" is same!why

    undefine

  • #2
    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, 03:03 AM.
    Glenn
    vBulletin Mods That Rock!

    Comment


    • #3
      I believe the W3C recommends you use disabled="disabled" for clarity in these situations.
      Last edited by Roy Sinclair; Feb 11, 2004, 11:37 AM.
      Check out the Forum Search. It's the short path to getting great results from this forum.

      Comment


      • #4
        Yes. I was just pointing out that any value (or no value at all) of the disabled attribute, the browser will render it disabled.
        Glenn
        vBulletin Mods That Rock!

        Comment

        Working...
        X