OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Can I have an HTML number input's arrows jump different than its step attribute?

  • Thread starter Thread starter Luke Vo
  • Start date Start date
L

Luke Vo

Guest
I have an <input type="number" step="1"> element for choosing font size. However, given the context of drawing on a large canvas, changing the number by 1 is barely noticeable. It would be more convenient for users if they could step up or down by 5 or 10 each time they click the arrow.

I still need to keep the step attribute at 1 because the input should remain valid even with fine-grained values. Is there a way to achieve this behavior, like the below (pseudo) jump attribute. I am open to Javascript solutions too but AFAIK there is no such event for when user clicks the arrows.


<input type="number" min="1" max="1000" step="1" jump="5" value="100" />

<p>I have an <code><input type="number" step="1"></code> element for choosing font size. However, given the context of drawing on a large canvas, changing the number by 1 is barely noticeable. It would be more convenient for users if they could step up or down by 5 or 10 each time they click the arrow.</p>
<p>I still need to keep the <code>step</code> attribute at 1 because the input should remain valid even with fine-grained values. Is there a way to achieve this behavior, like the below (pseudo) <code>jump</code> attribute. I am open to Javascript solutions too but AFAIK there is no such event for when user clicks the arrows.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><input type="number" min="1" max="1000" step="1" jump="5" value="100" /></code></pre>
</div>
</div>
</p>
 

Latest posts

I
Replies
0
Views
1
impact christian
I
Top