我正在尝试在我的项目中使用Bootstrap datepicker。我包括以下脚本和样式:
<link href="{{ url('/datepicker/css/datepicker.css') }}" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="{{ url('/js/jquery-3.1.1.min.js') }}"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="{{ url('/datepicker/js/bootstrap-datepicker.js') }}"></script>
输入日期的字段:
<div class="form-group ">
<div class='input-group date' id='datepicker'>
<input type="text" id="processdate" class="form-control datepicker" placeholder="Processing Date..." name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
</div>
<script>
$(document).ready(function () {
$('#datepicker').datepicker({
startDate: '-180d',
endDate: '+1d',
autoclose: true
});
});
</script>
但是当我打开页面时,我收到以下错误:
Uncaught TypeError: $(...).datepicker is not a function
at HTMLDocument.<anonymous> (register:135)
at j (jquery-3.1.1.min.js:2)
at k (jquery-3.1.1.min.js:2)
错误在哪里? 我用过这里的代码: http://jsfiddle.net/Lro8kxjx/6/