Bootstrap 4 DateTimePicker Multidate 不工作
Bootstrap 4 DateTimePicker Multidate not working
我正在尝试让 Bootstrap 4 DateTimePicker 工作,允许选择多个日期。如果我删除脚本中的 'multidate: true' 行,我下面的代码就可以工作。但是当那条线出现时,日期选择器甚至不显示。
谁能告诉我我做错了什么。
这是复制问题的最少代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<!-- Include Date Picker -->
<script language="javascript" src="https://momentjs.com/downloads/moment.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.min.css"/>
</head>
<body>
<div class="form-group ">
<h5 class="border-bottom mb-4">Date Picker</h5>
<div class="input-group datepicker">
<input class="form-control" id="datepicker" name=dates placeholder="yyyy-mm-dd" type="text"/>
<div class="input-group-addon">
<span class="fa fa-calendar"></span>
</div>
</div>
</div>
</body>
<script>
$(document).ready(function() {
$('.datepicker').datetimepicker({
format: "YYYY-MM-DD",
multidate: true
});
});
</script>
</html>
正确使用所有链接
$('#datepicker').datepicker({
format: "yyyy-mm-dd",
multidate: true
});
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://uxsolutions.github.io/bootstrap-datepicker/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<link href="https://uxsolutions.github.io/bootstrap-datepicker/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet"/>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="form-group ">
<h5 class="border-bottom mb-4">Date Picker</h5>
<div class="input-group datepicker">
<input class="form-control" id="datepicker" name=dates placeholder="yyyy-mm-dd" type="text"/>
<div class="input-group-addon">
<span class="fa fa-calendar"></span>
</div>
</div>
</div>
我正在尝试让 Bootstrap 4 DateTimePicker 工作,允许选择多个日期。如果我删除脚本中的 'multidate: true' 行,我下面的代码就可以工作。但是当那条线出现时,日期选择器甚至不显示。 谁能告诉我我做错了什么。 这是复制问题的最少代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<!-- Include Date Picker -->
<script language="javascript" src="https://momentjs.com/downloads/moment.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.min.css"/>
</head>
<body>
<div class="form-group ">
<h5 class="border-bottom mb-4">Date Picker</h5>
<div class="input-group datepicker">
<input class="form-control" id="datepicker" name=dates placeholder="yyyy-mm-dd" type="text"/>
<div class="input-group-addon">
<span class="fa fa-calendar"></span>
</div>
</div>
</div>
</body>
<script>
$(document).ready(function() {
$('.datepicker').datetimepicker({
format: "YYYY-MM-DD",
multidate: true
});
});
</script>
</html>
正确使用所有链接
$('#datepicker').datepicker({
format: "yyyy-mm-dd",
multidate: true
});
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://uxsolutions.github.io/bootstrap-datepicker/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<link href="https://uxsolutions.github.io/bootstrap-datepicker/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet"/>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="form-group ">
<h5 class="border-bottom mb-4">Date Picker</h5>
<div class="input-group datepicker">
<input class="form-control" id="datepicker" name=dates placeholder="yyyy-mm-dd" type="text"/>
<div class="input-group-addon">
<span class="fa fa-calendar"></span>
</div>
</div>
</div>