What is the correct value for the disabled attribute?

tskuzzy picture tskuzzy · Aug 5, 2011 · Viewed 110.9k times · Source

What is the correct value for the disabled attribute for a textbox or textarea?

I've seen the following used before:

<input type="text" disabled />
<input type="text" disabled="disabled" />
<input type="text" disabled="true" />

Answer

Erick Petrucelli picture Erick Petrucelli · Aug 5, 2011
  • For XHTML, <input type="text" disabled="disabled" /> is the valid markup.
  • For HTML5, <input type="text" disabled /> is valid and used by W3C on their samples.
  • In fact, both ways works on all major browsers.