0

I am trying to have the scroller open with a time value set conditionally. when the text input box is = 0 then set mobiscroll to value of 0. It appears that it defaults to 12 when input value is 0. I tried many approaches this is the closest I got...

$(function () {

    $('.in').scroller({
        preset: 'time',
        theme: 'default',
        display: 'modal',
        mode: 'mixed',
        stepMinute: 15,
        timeWheels: 'hhii',
        ampm: false,
        ampmText: false,
        timeFormat: 'hh:ii',
        onShow: function (valueText, inst) {
            scrollerVals = inst.temp;

            if ($(this).val() == "0" || $(this).val == null || $(this).val == "") {
                $(this).scroller().scroller('setValue', ['1', '0'])
            }
        }
    });

but it doesn't work. Any suggestions would be appreciated.

Joel Erenberg
  • 81
  • 2
  • 3

1 Answers1

0

First of all what would you like to achieve?

Second, mobiscroll is tied to an input, so it might not make sense to use the same for deciding on values.

For setting defaults use the 'setValue' method.

Levi Kovacs
  • 1,159
  • 8
  • 14
  • Thanks for the answer. I just solved this by changing to 24 hour format. This gives 0 in the scroller when the input text box (which is preloaded from a database query) has a zero. – Joel Erenberg Sep 18 '12 at 21:27