html - Is it possible to config up and down buttons for input[type="number"] have different step than input validation? -


i want number input which:

  • accept integer values in range [0, 1000], (e.g. 42 valid value)
  • reject non-integer values, (e.g. 3.14 invalid value)
  • when / down button pressed, value increase / decrease 10 (or increase nearest n * 10)

it seems step attribute config both input form validation , behavior of / down button. possible me make input have described behavior?

here go, working example:

 <input type="number" name="quantity" min="0" max="1000" step="10">

you can specify range using min , max attributes, , specifying how add or decrease on arrow click, can set step attribute.


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 -