我正在使用引导日期时间选择器,其文档可以在这里找到:https://eonasdan.github.io/bootstrap-datetimepicker/Options/
我正在尝试将所选日期设置为null。我可以在输入字段中保留日期(即2/10/2019),但是当我单击输入字段并打开日历时,旧日期仍以蓝色选中。 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)
});
});
此代码无效。你知道我应该尝试什么吗?
谢谢!
答案 0 :(得分:-1)
可以请您尝试使用“ useCurrent”选项吗?在这里https://eonasdan.github.io/bootstrap-datetimepicker/Options/#usecurrent
进行检查答案 1 :(得分:-1)