我正在使用 jQuery Datepicker,但在编辑记录时遇到问题。
// js code
$(function(){
$(".datepicker").datepicker().datepicker('option', 'dateFormat', 'yy-mm-dd').datepicker('option', 'changeMonth', 'true').datepicker('option', 'changeYear', 'true');
})
// the input
<input type="text" name="valid_from" value="2010-02-27" class="datepicker" />
但是当页面呈现时,显示的日期(并在我打开日期选择器时选择)是今天。
我实在无法理解发生了什么事。
最佳答案
您还应该更改代码,将所有选项放入一次调用中,如下所示
$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true,changeYear:true});
关于javascript - jQuery Datepicker 将日期更改为今天,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2517183/