![](/img/trans.png)
[英]BootStrap : Uncaught TypeError: $(…).datetimepicker is not a function
[英]Bootstrap datetimepicker TypeError: $(…).datetimepicker is not a function
嗨,嘗試將引導日期時間選擇器應用於輸入時,出現以下錯誤。
我已經檢查了源,並且沒有兩次引用任何JS庫。
我也嘗試過改寫我的引用順序,但沒有任何運氣。
有人知道我可能做錯了嗎?
我正在使用: https : //eonasdan.github.io/bootstrap-datetimepicker/
錯誤:
未捕獲的TypeError:$(...)。datetimepicker不是函數
我的_layout.chtml的開頭:
<script type="text/javascript" src="/Scripts/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script type="text/javascript" src="/Scripts/moment.min.js"></script>
<script type="text/javascript" src="/Scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="/Scripts/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="/Content/bootstrap.min.css" />
<link rel="stylesheet" href="/Content/bootstrap-datetimepicker.min.css" />
我的edit.chtml的正文
<div class="form-group">
@Html.LabelFor(model => model.DateOfBirthDateTime, htmlAttributes: new { @class = "date-picker-standard control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DateOfBirthDateTime, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DateOfBirthDateTime, "", new { @class = "text-danger" })
</div>
</div>
我的edit.chtml的底部
<script type="text/javascript">
$(function () {
$(document).ready(function () {
$('.date-picker-standard').datetimepicker();
});
});
</script>
問題解決了:
這隱藏在我的_layout.chtml的底部
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.