Though both disabled and read only primary job is preventing content being edited, still there are few differences exists between them. Below i have given differences between html disabled and readonly elements.

Disabled elements,
  • Do not receive focus
  • Skipped from tab navigation
  • Should not be posted on form submission
       These elements supports disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT AND TEXTAREA

       <input name='sample' value='test' disabled>

Read Only elements,
  • Receives the focus
  • Included in tab navigation
  • Values can be posted during form submission
       These elements supports readonly attribute: INPUT, TEXTAREA

       <input name='sample' value='test' readonly>


Comments (0)
Leave a Comment

loader Posting your comment...