我使用的是引导日期时间选择器,文档这些都可以在这里找到:https://eonasdan.github.io/bootstrap-datetimepicker/Options/
我试图设置选定的日期为null。我能空出输入字段中的日期(即2019年2月10日),但是当我点击输入字段和日历打开,旧日期以蓝色仍处于选中状态。 WiThis是我的代码以取消选择在日历中的所有日期。
$(document).ready(function() {
$('.removedate').on('click', function(){
$("#id_booking_date").val('') //this correctly removes date from input field
$('.input-group').datetimepicker({
date: new Date(null)
});
});
此代码不能正常工作。你知道我应该尝试一下呢?
谢谢!
可否请您尝试使用此“useCurrent”选项?看看这里https://eonasdan.github.io/bootstrap-datetimepicker/Options/#usecurrent