How to make input type=”number” to positive numbers only with HTML?

Spread the love

Sometimes, we want to make input type="number" to positive numbers only with HTML.

In this article, we’ll look at how to make input type="number" to positive numbers only with HTML.

How to make input type="number" to positive numbers only with HTML?

To make input type="number" to positive numbers only with HTML, we set the min attribute.

For instance, we write

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

to set the min attribute to 0 to make sure that users can only numbers 0 or higher.

Conclusion

To make input type="number" to positive numbers only with HTML, we set the min attribute.

Leave a Reply

Your email address will not be published.