gpt4 book ai didi

jquery - 文本输入字段作为 jQuery 日期选择器默认日期

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

jQuery 日期选择器的默认日期是当前日期,但我需要它是我的 #start_date 输入字段中预先填充的日期。

这就是我现在所处的位置,但它不起作用。

var start_date = $('#start_date').val();
$('.datepicker').datepicker("option", "defaultDate", start_date);
<input type="text" id="start_date" name="start_date" class="datepicker form-control col-sm-6" placeholder="Start" value="<?php (!empty($row['start_date'])?$row['start_date']:'');?>>

最佳答案

尝试:

var start_date = $('#start_date').val();
$('.datepicker').datepicker("option", "defaultDate", new Date(start_date));

关于jquery - 文本输入字段作为 jQuery 日期选择器默认日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29808324/

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