In HTML you can add the step
attribute to inputs of type number. I wanted this because I liked how it can simplify the input for the user, by only pressing the up/down key.
I found out that an additional feature of this attribute is, that it forces the user to stay in that interval. HTML does this with validation. You can enter any value manually, but it won't let you submit the form. I don't want this!
To work around with this, I found that there is a novalidate
attribute that is used in the <form>
tag, which works great. But sadly, the browser support is poor.
I guess I'd need to remove the step
attribute and write the functionality by myself with JavaScript/jQuery by triggering the keydown event on it.
But sadly, the browser support is poor.
That's not true. According to MDN, IE supports the novalidate
attribute since version 10, and input[type=number]
also since version 10. This means that if a browser supports number inputs, it most likely also supports the novalidate
attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With