在wickedpicker中设置默认时间

时间:2016-09-08 12:53:28

标签: javascript jquery wickedpicker

我目前正在使用wickedpicker。当用户执行按钮单击操作时,我需要将默认时间设置为两个wickedpicker控件。 timepickers.wickedpicker('time',1)返回时间,但它不会提供任何设置时间的方法。

你能告诉我,我怎么能达到同样的目标?

1 个答案:

答案 0 :(得分:0)

你可以重新实例化。

以下是选项: -

var options = {
  now: "12:35", //hh:mm 24 hour format only, defaults to current time
  twentyFour: false, //Display 24 hour format, defaults to false
  upArrow: 'wickedpicker__controls__control-up', //The up arrow class selector to use, for custom CSS
  downArrow: 'wickedpicker__controls__control-down', //The down arrow class selector to use, for custom CSS
  close: 'wickedpicker__close', //The close class selector to use, for custom CSS
  hoverState: 'hover-state', //The hover state class to use, for custom CSS
  title: 'Timepicker', //The Wickedpicker's title,
  showSeconds: false, //Whether or not to show seconds,
  secondsInterval: 1, //Change interval for seconds, defaults to 1,
  minutesInterval: 1, //Change interval for minutes, defaults to 1
  beforeShow: null, //A function to be called before the Wickedpicker is shown
  show: null, //A function to be called when the Wickedpicker is shown
  clearable: false, //Make the picker's input clearable (has clickable "x")
};

$('.timepicker').wickedpicker(options);

所以在按钮click中,请致电: -

$('button').click(function(){
    $('.timepicker').wickedpicker({ now: "12:35" });  
});