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 -

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' -