gpt4 book ai didi

jquery - jquery 日期选择器的默认值

转载 作者:行者123 更新时间:2023-12-03 22:50:15 25 4
gpt4 key购买 nike

我有一些关于 jQuery UI 日期选择器的问题。

1 - 是否可以选择设置默认值?我想做的是用今天的日期预先填充我的输入文本类型。

2 - 如果我输入 type =“Date”而不是 type =“Text”,然后使用 jquery 时间选择器,则在选择日期时会出现此错误。

 The specified value '02/18/2015' does not conform to the required format, 'yyyy-MM-dd.'

如何解决这个问题?

最佳答案

To create the date picker and set the date. You can assign today's date by 'new Date().' You can set input type=text or type=date.

$('.datepicker').datepicker({ 
dateFormat: 'dd-mm-yy'
}).datepicker("setDate", new Date());

关于jquery - jquery 日期选择器的默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28604379/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com