How can I limit a html input box so that it only accepts numeric input? -


i have html input box, numeric data data. how can enforce that?

you can use html5 validate type of input without using javascript. however, method not (yet) supported browsers.

<input type="number" name="quantity" min="1" max="5"> 

use following attributes specify restrictions (as described here):

  • max - specifies maximum value allowed
  • min - specifies minimum value allowed
  • step - specifies legal number intervals
  • value - specifies default value

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -