Jump to content

saila.com

Online media matters

Why can’t my checkbox be made read-only?

There has been some debate about this caused by an unclear description in the actually HTML 4.01 DTD and inconsistent browser support. The general consensus is that the readonly attribute only applies to inputs that have type set to “test” or “password”.

No one seems to have explained the reasoning for this behaviour, which seems based on an unenforceable DTD comment, and an illogical correction in the appendix for HTML 4 that wasn’t carried forward to HTML 4.01.

Adding to the confusion Internet Explorer accepts readonly on radio buttons, but not checkboxes.