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

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -