<input type=number> and format using one decimal place in Chrome
pattern
is used to specify a regular expression that any value the user supplies should match. Something like pattern='[0-9]+\.[0-9]'
should specify 1 or more digits, a decimal, then 1 digit. You might also want to set the step size to 0.1 (step=0.1
) to force only 1 decimal. I don't know if chrome will respect the pattern and size attributes or not, but that is how to specify them.