Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    undefine
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    undefine

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    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)

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I believe the W3C recommends you use disabled="disabled" for clarity in these situations.
    Last edited by Roy Sinclair; 02-11-2004 at 04:37 PM.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Yes. I was just pointing out that any value (or no value at all) of the disabled attribute, the browser will render it disabled.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •