我在我的代码中使用了bootstrap-datepicker。如何在JavaScript中选择当前日期并将其显示为选中状态?在Bootstrap中设置当前日期datepicker
研究后,这是我使用的代码,但作为选择当天不出现:
var today = moment();
datepicker1.datepicker({
endDate: today.toDate()
});
datepicker2.datepicker({
startDate: today .toDate(),
endDate: today.toDate()
});
datepicker1.datepicker('setDate', today.toDate());
datepicker2.datepicker('setDate', today.toDate());
datepicker1.datepicker('update'); //update the bootstrap datepicker
datepicker2.datepicker('update');
也许我想念的东西,但:'开始日期:新的Date()'???但是请等待,默认情况下它会选择当前日期,因此我真的不确定要了解您的问题? –
1.日期不在日期中输入输入字段 2.日期未被选中 - 日期选择器 –