Black Lives Matter! ✊🏾

type="number"

The input element represents a control for setting the element’s value to a string representing a number. 4.10.5.1.12. Number state (type=number)

Links about type="number"

  1. Why the GOV.UK Design System team changed the input type for numbers

    posted on by Hanna Laakso, GDS, Frontend Developer

    We take a look at why the GOV.UK Design System changed the element it uses for inputting numbers, making it more accessible and easier to use

  2. You probably don’t need input type=“number”

    posted on by Brad Frost

    Last week I got a call from my bank regarding a wire transfer I had just scheduled. The customer support guy had me repeat everything back to him because there seemed to be a problem with the information. “Hmmmm, everything you said is right right except the last 3 digits of the account number.”

    Tags:
  3. <input type=“number”>

    posted on by MDN

    input elements of type number are used to let the user enter a number. They include built-in validation to reject non-numerical entries.

Code sample

<label>
How much do you want to charge?
$<input type="number" min="0" step="0.01">
</label>