javascript - 在 Bootstrap 日期时间选择器上将日历中的选定日期设置为 null
问题描述
我正在使用引导日期时间选择器,其文档可以在这里找到:https ://eonasdan.github.io/bootstrap-datetimepicker/Options/
我正在尝试将所选日期设置为空。我可以在输入字段中清除日期(即 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)
});
});
此代码不起作用。你知道我应该尝试什么吗?
谢谢!
解决方案
您可以尝试为此使用“useCurrent”选项吗?在这里查看https://eonasdan.github.io/bootstrap-datetimepicker/Options/#usecurrent
推荐阅读
- php - Workerman 发送消息后突然关闭
- ruby-install - 如何使用 ruby-install 安装 Ruby 的预览版
- node.js - 如何将返回promise的异步函数转换为节点js中的同步函数
- amazon-web-services - 启用 boto3 在 ECS 实例上发送 SES 而不使用 IAM 访问密钥/秘密
- java - 复制列表
- > 有尺寸限制
- sql - 经常性事件出勤数据库设计
- javascript - 未捕获的错误、语法错误、无法识别的表达式 [JQUERY]
- debugging - clion 调试器“无法找到和加载段”
- video-streaming - GStreamer - RTSP 流到 FLV 文件
- sql-server - SQL Server:将 IPv6 转换为 INTEGER