Home / Notes /

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.

“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 max attribute set to 9999 will do the same thing, and it’s more semantic.”

Read on Picalilli