Dejell
Dejell

Reputation: 14317

JQuery - hour spinner

I need to use the JQuery spinner for hours so the template will be: 00:00:00:00

Currently the spinner is set only for numbers.

How can I do it?

Upvotes: 0

Views: 3476

Answers (1)

Mottie
Mottie

Reputation: 86413

The easiest solution would be to have a spinner for each number. I set up a demo here.

HTML

<div class="demo">
 <p>
  <label for="amount">Set the time (hh:mm:ss:fr):</label>
  <input class="time hour" name="hour" value="0" />
  <input class="time min" name="min" value="0" />
  <input class="time sec" name="sec" value="0" />
  <input class="time frames" name="frames" value="0" />
 </p>
</div>

Script

$(function() {
 $(".time").spinner({
  min: 0,
  max: 59,
  step: 1,
  start: 0,
  precision: 0,
  width: '2em'
 });    
 $(".hour").spinner('option','max', 23);
 $(".frames").spinner('option', 'max', 100);
});

Upvotes: 2

Related Questions