New answers tagged


You should use the min attribute of the input element as it will prevent from entering negative values into the input field. Ex. <input type="number" min="0"> Or else you can use the onkeydown attribute of the input element. It will prevent user from inserting special characters. Ex. <input type="number" onkeydown="javascript: return event....

Top 50 recent answers are included