[html5] Is html5.validator.nu wrong about <input>

Smylers Smylers at stripey.com
Tue Apr 10 03:23:23 PDT 2012

Prof. T.D. Wilson writes:

> *Error*: Attribute maxlength not allowed on element
> input<http://www.whatwg.org/specs/web-apps/current-work/#the-input-element>
> at this point.
> From line 342, column 2; to line 342, column 206
> ht:32;">↩ *<input type="hidden" name="q" maxlength="255" ...

What are you intending the maxlength attribute to do on a hidden

> However, all the information I can find about both 'maxlength' and
> 'size' (which is also rejected in the same way) tells me that both are
> permitted in html5. Is the validator wrong on this?

Note the validator says "at this point", not that they are invalid on
all <input> elements.

This table in the HTML5 spec shows which of <input>'s many attributes,
including maxlength, can be used when:

Note that XHTML1 (via HTML4) only defines maxlength for <input> elements
with type="text" or "password", so this probably should've been picked
up as a problem in your XHTML1, too.



More information about the Help mailing list