tags:

views:

122

answers:

1

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?

A: 

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);
});
fudgey
Thanks, but I need it in one input box, and when the status is 00:00:59:00 and the user clicks up it will turn to 00:01:00:00
Odelya
Then maybe this plugin (http://keith-wood.name/timeEntry.html) is what you want.
fudgey
I will have to adjust it - and it's a very long code:(. I thought of a shorter solution
Odelya