CREATE A NUMBER INPUT TYPE

You can use the number input type to restrict input fields to numeric values only. Supported web browsers will inhibit any nonnumeric data from being submitted. You can set a minimum and maximum number range and an interval. If a number is outside of the specified range or is not divisible by the stepping value, it will be rejected with a pop-up message.

<input type='number' name='field'
 value='number' min='number' max='number'
 step='number'>

The type='number' attribute value activates the number-specific input options of the user’s web browser, if supported. Additional input element attributes, such as name and value, have the same meaning and functionality common in HTML forms. Any combination of the min, max ...

Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.