Skip to main content

HTML Guide

Bad value “X aria-required=” for attribute “maxlength” on element “input”: Expected a digit but saw “ ” instead.

The value of the maxlength attribute contains invalid characters because it is incorrectly combined with another attribute.

In HTML, the maxlength attribute for an input element should contain only a non-negative integer value, which specifies the maximum number of characters allowed in the input. The aria-required attribute must be a separate attribute in the tag.

Correct usage separates each attribute and assigns the appropriate value using quotation marks for each. For example, maxlength="200" and aria-required="true" must be distinct and not combined.

Incorrect:

<input type="text" name="nome" id="nome" maxlength="200 aria-required="true">

Correct:

<input type="text" name="nome" id="nome" maxlength="200" aria-required="true">

This valid example uses maxlength="200" for character limit and adds aria-required="true" to improve accessibility for assistive technologies.

Learn more:

Related W3C validator issues