What is the proper way (standards compliant) way to add selected
, disabled
and similar attributes to <input>
elements in HTML?
I have seen:
<input type="text" disabled>
<input type="text" disabled="disabled">
<input type="text" disabled="yes">
As far as I can tell, they all work, regardless of what the attribute's value is.
What is the right way to do this?
disabled
is a boolean attribute.disabled="disabled"
is the correct form;disabled
alone is shorthand allowed in HTML.From On SGML and HTML: