Dynamic HTML5 number step.
HTML5 forms has own validation for step
rule.
This plugin add step
attribute to field temporarily while changes are made.
You can specify any numeric value on keyboard.
HTML5 step validation will not be applied.
Demo
https://codepen.io/ArtZ91/pen/omePje
How to use
- include
jquery.number-step.js
script to your web page. jQuery required!
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="jquery.number-step.js"></script>
- Add
optionalNumberStep
function to yourinput[type="number"]
fields.
$('[name="width"]').optionalNumberStep(100);
- To deactivate dynamic step use 'unset' value.
$('[name="width"]').optionalNumberStep('unset');