Himanshu Raj
Himanshu Raj

Reputation: 47

Maxlength and Minlength ignored for input type=“number”

The maxlength attribute is not working with

<input type="number" maxlength="5" maxlength="10" />

Upvotes: 4

Views: 10801

Answers (1)

Gulam Hussain
Gulam Hussain

Reputation: 1763

HTML input type number does not have maxlength and minlength attribute, instead it has min and max attribute, you can use min and max to length of input.

For eg. for maxlength 2 and minlength 0, you can use min and max like this-

<input type="number" min="0" max="99" />

Upvotes: 7

Related Questions