2

I am using the below code to showtimepicker when clicking on an input type text. Is there a way to set a default value such as 01:00for the time picker??

$.plugin($afterSubPageLoad,{
end_time_picker:function()
{
    $(function(){$('#actualHours').scroller({preset: 'time',theme: 'wp',display: 'modal',mode: 'mixed',timeFormat:'HH:ii',timeWheels:'HHii'});});       
}
});
Midhun Mathew
  • 2,147
  • 8
  • 28
  • 45

3 Answers3

5

You do it with the setValue method:

$('#actualHours').mobiscroll('setValue','01:00');
Levi Kovacs
  • 1,159
  • 8
  • 14
  • I found that this works for an exact hour i.e. :00 but doesn't work for times off the hour you need to drop the : $('#actualHours').mobiscroll('setValue','1315'); – Steve Dec 22 '13 at 05:22
0

Just define the default date or time in the value attibute of your input element depending on the local date time parameters you are using (yyyy-mm-dd , dd.mm.yyyy, ...) like :

<input name="user-select-datetime-to" id="user-select-datetime-to" value="03.07.2013 15:04"/> 

or

<input name="user-select-time-to" id="user-select-time-to" value="10:00"/> 
sdespont
  • 13,915
  • 9
  • 56
  • 97
0

I know this is older question, but this is what I had to do in order to default the time.

 var showModalTimePickerWithDefaultTime = function (defaultTime)
  {
    $('.item-cell.right').mobiscroll().time({
      mode: 'scroller',
      theme: kendo.support.mobileOS.ios ? 'ios' : 'android',
      display: 'modal',
      animate: 'fade',
      dateFormat: '',
      timeFormat: 'hh:ii A',
      dateOrder: 'hhiia'
    });
    $('.item-cell.right').mobiscroll('setValue', defaultTime);
  }
DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127
Sean
  • 1,359
  • 11
  • 15