• Blogs (9)
    • 📱 236 - 992 - 3846

      đź“§ jxjwilliam@gmail.com

    • Version: ‍🚀 1.1.0
  • input: readonly vs disabled

    Blogs20152015-02-06


    input: readonly vs disabled

    a readonly element is just not editable, but gets sent when the according form submits. a disabled element isn’t editable and isn’t sent on submit. another difference is that readonly elements can be focused (and getting focused when “tabbing” through a form) while disabled elements can’t.

    read more about this in this great article or the definition by w3c. to quote the important part:

    Key Differences

    1. The Disabled attribute
    • Values for disabled form elements are not passed to the processor method. The W3C calls this a successful element.(This works similar to form check boxes that are not checked.)
    • Some browsers may override or provide default styling for disabled form elements. (Gray out or emboss text) Internet Explorer 5.5 is particularly nasty about this.
    • Disabled form elements do not receive focus.
    • Disabled form elements are skipped in tabbing navigation.
    2.The Read Only Attribute
    • Not all form elements have a readonly attribute. Most notable, the