Is it possible to detect when the stepper arrows are clicked in an HTML number input? My inputs are arbitrary size decimals, so I have an attribute step=0.00000001
to have a valid <input type=number>
. However, the stepper arrows should increase/decrease by 0.01
. So if a function can be called when those arrows are clicked, I can programmatically increase/decrease the input.
3
Answers
You just need to use the onChange function:
Edit:
I think for your specific example you would need to use a combination of onChange, onmousedown and onkeydown.
Your input html would look like:
And you would need to use some javascript to store and check the change of the values like so:
Do you mean like this?
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event
As a complement for my comments: