Skip to main content

Huntly Cameron ­//My blog type thing…

html5 number field

By default, the HTML5 <input type="number"> field is a floating point value. I.e. 2.0 rather than 2. If you want a whole number (1, 2, 34, 230, e.t.c) you need to implement the step attribute along with the min attribute, like so: <input type="number" min="0" step="1">

Kudos to Aurélien Ooms and his answer on Stack Overflow