如何在Jquery Timepicker中设置默认时间(Trent Richardson) [英] How to set default Time in Jquery Timepicker(Trent Richardson)

查看:142
本文介绍了如何在Jquery Timepicker中设置默认时间(Trent Richardson)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些人试图设置由Trent Richardson提供的jquery Timepicker插件的defaultValue

但未能这样做,因为timpicker的滑块仍然指向0小时0分钟而不管defaultValue为时间戳设置。



这就是我的尝试

Hi,guys trying to set the defaultValue of the jquery Timepicker addon provided by Trent Richardson
but have failed to do so as the sliders of the timpicker still point to 0hours 0 mins irrespective of the defaultValue set for the timepicker.

This is what I have tried

var dates = new Date();
              
              dates.setTime(dates.getTime());





$('#timePickers')。 timepicker({defaultValue:dates.getTime(),timeOnlyTitle:'选择时间',});

但到目前为止没有运气



$('#timePickers').timepicker({ defaultValue: dates.getTime(), timeOnlyTitle: 'Choose Time', });
but no luck so far

推荐答案

('#timePickers')。timepicker({defaultValue:dates.getTime(),timeOnlyTitle:'选择时间',});

但到目前为止没有运气
('#timePickers').timepicker({ defaultValue: dates.getTime(), timeOnlyTitle: 'Choose Time', });
but no luck so far


问题已经解决,在一个简单的行中找到了解决方案
The issue has been resolved found a solution in a single simple line


('#timePickers')。timepicker({defaultValue:times.getHours()+' :'+ times.getMinutes()});
('#timePickers').timepicker({ defaultValue: times.getHours() + ':' + times.getMinutes() });


这篇关于如何在Jquery Timepicker中设置默认时间(Trent Richardson)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆