I have this fiddle:
http://jsfiddle.net/rkTCq/
The code is just a type number input field with a pattern
pattern="[0-9]+(\.[0-9]+)?"
CSS adds a red border if the input is invalid:
input:invalid { border:1px solid red; }
However, if I dial 1.3 and then exit the field, I get a red border, although this is true according to the pattern. What is wrong here?
PS: This is a safari.
Edit: OK, I added step = "any" and this seems to fix it. Can you guys confirm?
http://jsfiddle.net/rkTCq/2/
css html5 validation
Wesley
source share