maxLength


maxLengthnumber

Sets or gets the maximum number of characters that can be entered.

Setting the maxLength property of an input element to a positive number restricts user input, by manual entry or pasting, to text that does not exceed the maxLength. However, it does not limit your ability to change the element's value to one that exceeds maxLength programmatically.

To remove the maximum length restriction that has been set on the input element, set maxLength to null or undefined.

Getting the maxLength property returns the element's current maxLength setting.

The number of characters is calculated by Unicode code points.

Did this help?