Using the step and pattern attributes to make number inputs more useful
Cassidy Williams explains how to get the most from the oft-maligned number input.
Read on Picalilli“This approach of using pattern is particularly good for adhering to specific patterns, like ‘a number that is exactly 4 digits’ (pattern="[0-9]{4}"), rather than limiting input data to a certain number of decimal places. But, the
maxattribute set to9999will do the same thing, and it’s more semantic.”