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

Tural Ali picture Tural Ali · Sep 10, 2011 · Viewed 317.2k times · Source

I want to get only positive values, is there any way to prevent it using only html
Please don't suggest validation method

Screenshot of input control

Answer

Abraham picture Abraham · Sep 10, 2011

Use the min attribute like this:

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