Question

How do I call the onBeforeShow event with mobiscroll?

$('#starttime').mobiscroll('setValue', value).time({
        theme: 'jqm',
        display: 'modal',
        mode: 'clickpick',
        stepMinute: 10,
        onBeforeShow:  
 });

I need to set the time right before it shows. If I try to do it on document ready the input field isn't ready yet with the value...

Edit

I tried:

$('#starttime').mobiscroll('setValue', value).time({
        theme: 'jqm',
        display: 'modal',
        mode: 'clickpick',
        stepMinute: 10,
        onBeforeShow: function(html, inst) {
            start = $('#starttime').val();
            var a = moment();
            var value = a.format('h:mm A');

            }
        });

but then I'm getting the error: 'value is not defined'...

Was it helpful?

Solution

You have to provide a callback function.

$('#starttime').mobiscroll('setValue', value).time({
        theme: 'jqm',
        display: 'modal',
        mode: 'clickpick',
        stepMinute: 10,
        onBeforeShow: function (html, inst) {
            //Gets called before the scroller appears. The function receives the jQuery object containing the generated html and the scroller instance as parameters
        }
 });

http://docs.mobiscroll.com/23/mobiscroll-core

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top