gpt4 book ai didi

jquery - 如何在 jquery ui Datepicker 中将日期时间设置为默认值

转载 作者:行者123 更新时间:2023-12-01 04:58:59 25 4
gpt4 key购买 nike

<script type="text/javascript" language="javascript">
$(document).ready(function () {
$(function () {
$(".datepicker").datepicker({
dateFormat: "mm/dd/yy",
changeMonth: true,
changeYear: true
});
});
});
</script>

我使用上面的代码在日期选择器中显示日期,但日期设置为 2001 年 1 月。如何在上面的 jquery 中将日期时间设置为今天作为默认值。在我将 jquery 放入编辑器模板之前,它工作得很好。

最佳答案

根据 jQuery UI documentation 这应该是默认行为。当默认情况下 defaultDate 选项为 null 时,今天的日期应在首次打开时突出显示。也许你的系统时间不正确?这是 codepen我在那里尝试过,它似乎默认显示今天的日期。

关于jquery - 如何在 jquery ui Datepicker 中将日期时间设置为默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11919893/

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