简体   繁体   中英

Set default time in wickedpicker

I currently using wickedpicker. I need to set the default time to two wickedpicker control when a user perform the button click operation. The timepickers.wickedpicker('time', 1) returns the time, but it wont provide any method to set the time.

Could you please tell me, how I can achieve the same?

you could re-instantiate it.

Here are the options:-

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

so in your button click , call:-

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM