Controlling the step between values
There are several ways with which we can control the steps in the spinner widget. The step is the value that the spinner widget uses to move its number either up or down. For example, you'll often see loop code that increments a counter cnt ++
. Here, the step is one and this is what the spinner step value defaults to. Changing this option in the spinner is trivial; we can even change this value after the widget has been created.
There are other measures we can take to control the stepping behavior of the spinner. Let's take a look at the incremental option and see how this impacts the spinner.
How to do it...
We'll create three spinner widgets to demonstrate the potential of the incremental option. Following is the HTML structure:
<div class="spinner-container"> <h3>Non-incremental</h3> <input id="spin1" /> </div> <div class="spinner-container"> <h3>Doubled</h3> <input id="spin2" /> <...