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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -