How to set max-length in an HTML5 “input type=number” element?

Spread the love

Sometimes, we want to set max-length in an HTML5 "input type=number" element.

In this article, we’ll look at how to set max-length in an HTML5 "input type=number" element.

How to set max-length in an HTML5 "input type=number" element?

To set max-length in an HTML5 "input type=number" element, we can set the max attribute.

For instance, we write

<input type="number" min="1" max="999" />

to set the max attribute to the maximum number allowed to be inputted.

Conclusion

To set max-length in an HTML5 "input type=number" element, we can set the max attribute.

Leave a Reply

Your email address will not be published. Required fields are marked *