我知道这已经有很多线索了。我已经阅读了很多这些并尝试了解决方案,但都无济于事。
这就是我的想法:
<script src="/Areas/IRF/Scripts/jquery-2.1.3.js"></script>
<script src="/Areas/IRF/Scripts/jquery.inputmask/jquery.inputmask.js"></script>
<script src="/Areas/IRF/Scripts/jquery.validate.js"></script>
<script src="/Areas/IRF/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/Areas/IRF/Scripts/moment.js"></script>
<script src="/Areas/IRF/Scripts/bootstrap-datetimepicker.js"></script>
<script src="/Areas/IRF/Plugins/PNotify/pnotify.custom.min.js"></script>
<script src="/Areas/IRF/Scripts/CustomModules/app-notifications.js"></script>
还有一些CSS文件:
<link href="/Areas/IRF/Content/bootstrap.css" rel="stylesheet" />
<link href="/Areas/IRF/Content/bootstrap-datetimepicker.css" rel="stylesheet" />
<link href="/Areas/IRF/Content/typeahead.css" rel="stylesheet" />
<link href="/Areas/IRF/Content/site.css" rel="stylesheet" />
<link href="/Areas/IRF/Plugins/PNotify/pnotify.custom.min.css" rel="stylesheet" />
<link href="/Areas/IRF/Content/irf-theme.css" rel="stylesheet" />
<link href="/Areas/IRF/Plugins/Qtip/jquery.qtip.min.css" rel="stylesheet" />
则...
<script type="text/javascript">
$(document).ready(function () {
... some stuff
});
$(function () {
$('.RequestedResponseDate').datepicker({
format: 'mm/dd/yyyy',
startDate: '-3d'
});
});
</script>
最后......
<div class="input-group date" data-provide="datepicker">
<input class="form-control datepicker valid" data-val="true" data-val-date="The field Requested Response Date must be a date." id="RequestedResponseDate" name="RequestedResponseDate" placeholder="MM/DD/YYYY" type="text" value="" aria-describedby="RequestedResponseDate-error">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
我收到此错误:
New:514 Uncaught TypeError: $(...).datepicker is not a function
(anonymous function) @ New:514fire @ jquery-2.1.3.js:3094
self.fireWith @ jquery-2.1.3.js:3206
jQuery.extend.ready @ jquery-2.1.3.js:3412
completed @ jquery-2.1.3.js:3428
我试图重新排序ref-jquery-2.1.3.js所在的位置(将其向下移动)但这只会导致其他问题。我也尝试添加$ .noConflict();
$.noConflict();
$(function () {
$('.RequestedResponseDate').datepicker({
format: 'mm/dd/yyyy',
startDate: '-3d'
});
但是同样的错误会出现两次!
Uncaught TypeError: $ is not a function
(anonymous function) @ New:514
答案 0 :(得分:1)
问题最终成为对jquery-ui.js的缺失引用
答案 1 :(得分:0)
您需要添加bootstrap-datepicker.js
而不是bootstrap-datetimepicker.js
。
它们是不同的插件