I have in input box that can only contain numerical values (with use of this plugin).
Now I want the input to be below, say 90.
If a value is entered that exceeds this max cap or cannot be parsed, the previous value should be inserted.
By default, the box will contain "1".
<input id="targetQuantity" name="targetQuantity" type="text" value="1" />
I imagine I should catch the current value somehow. Try to parse the new value. If it is an allowed value, continue with this value, if not, put the old one back.
As my JS skills are really limited I don't even know what events are available to me and I find the documentation I found on the intarwebz rather confusing.
--EDIT--
I ended up using Sergei's code and using Aaron's usability advice.
All I'm looking for now is to enable/disable a whole form's submit.
Just disabling a submit button is not enough.