Definition and Usage

The maxlength attribute specifies the maximum number of characters allowed in the element.


Applies to

The maxlength attribute can be used on the following elements:

Elements Attribute
  maxlength
  maxlength

Examples

Input Example

An element with a maximum length of 10 characters:

 


  Username: 

  

Textarea Example

A text area with a maximum length of 50 characters:


Enter text here...