Midhun Mathew
Midhun Mathew

Reputation: 2207

Set Default time to mobiscroll time picker

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'});});       
}
});

Upvotes: 2

Views: 3295

Answers (3)

Sean
Sean

Reputation: 1547

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);
  }

Upvotes: 0

Levi Kovacs
Levi Kovacs

Reputation: 1159

You do it with the setValue method:

$('#actualHours').mobiscroll('setValue','01:00');

Upvotes: 5

sdespont
sdespont

Reputation: 14025

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"/> 

Upvotes: 0

Related Questions