javascript - How do I make a negative amount in form field produce a warning error -


i have .html form field when changes negative number, warns users field needs positive number ?

appreciate assistance.

in onblur event handler of html field, write javascript function check if value number. if is, check whether less 0. if yes, write css make field border red or display warning.

or, can use field input type number min value set in html5.

<input type="number" name="f1" id="f1" min="0"> 

Comments

Popular posts from this blog

php - Cannot override Laravel Spark authentication with own implementation -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -