Skip to main content
HTML Validation

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

About This HTML Issue

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.

Last reviewed: April 22, 2025

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.