I’ve a textbox, in which when user clicks top arrow, the value in textbox should increment by 10.
For example, if the textbox value is 12, when user press up arrow, it should show 22, again pressing the up arrow, it should show 32 etc. While clicking down arrow, it should substract 10, so the value that displayed should be 22 (32-10).
<input type="number" id="txtIncrementBy10" step="10" min="0" name="txtIncrementBy10" value="0" />
I provided the step as 10, for this functionality. It is incremented +10 each time user presses up arrow. But the issue I have is it not adding to the value in textbox. Like, if the value in textbox is 33, so pressing up arrow, it shows 40, instead of 43.
Is there a way, for it to add +10 to the value in textbox?
I have set the interval to 10, but as mentioned before, when pressing up/down arrow, it is just incrementing value as 10, 20, 30… etc. I want it to add +10 to the value in the textbox instead.
2
Answers
Try below code. Hope this could help you.
Please let me know if this could help you.
You will need custom +/- buttons, and some javascript. Something like this: