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.
<input type="number" name="futureDailyAdSpend" value="138.03" step="50" min="50" formnovalidate/>
. I get this error: "Please enter a valid value. The two nearest valid values are 100 and 150." I want to allow users to click the up/down arrows to step in increments of 50, but I also want to allow users to type in a more precise number. – Photima