Is there any way to prevent input type=”number” getting negative values?

Use the min attribute like this:

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

Leave a Comment