如何在打开Bootstrap datetime-picker时删除旧的插入日期,如下所示?
此外,从Bootstrap3升级到4后,日期时间选择器无效。 什么是不能使用或有错误?
这是主HTML页面中的css和js cdn define。
<link rel="stylesheet" href="/css/select2_4.0.3.css">
<link rel="stylesheet" href="/css/AdminLTE.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.3.11/css/skins/_all-skins.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/iCheck/1.0.2/skins/square/_all.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
<link rel="stylesheet" href="/css/customStyle.css">
///////////////////////////////////
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.0/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/iCheck/1.0.2/icheck.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.3.11/js/app.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
/////////////////////////////////////
$('#datepicker_from').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd',
todayHighlight: true
});
$('#datepicker_to').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd',
todayHighlight: true
});
$('#dateTimePicker_created_at').datetimepicker({
format: 'YYYY-MM-DD HH:mm:ss',
});
$('#dateTimePicker_deleted_at').datetimepicker({
format: 'YYYY-MM-DD HH:mm:ss',
});
$('#dateTimePicker_created_at').on('keypress', function (e) {
e.preventDefault();
});
$('#dateTimePicker_deleted_at').on('keypress', function (e) {
e.preventDefault();
});