[英]Enable jQuery ui in asp.net MVC web app
I have an asp.net mvc
application in Visual Studio 2013
. 我在Visual Studio 2013
有一个asp.net mvc
应用程序。 I have a problem when using jQuery UI
tools. 使用jQuery UI
工具时出现问题。 I have the following scripts in my _Layout.cshtml
: 我的_Layout.cshtml
包含以下脚本:
@Scripts.Render("~/bundles/modernizr")
<script src="@Url.Content("~/Scripts/1.7.2.jquery.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-2.1.0.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-2.1.0.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.10.4.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.10.4.min.js")" type="text/javascript"></script>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
when I try to use datepicker()
: 当我尝试使用datepicker()
:
<script type="text/javascript">
jQuery(document).ready(function () {
$('.rDate').datepicker();
});
</script>
@Html.TextBox("date", new DateTime(2014, 1, 1), new { @class=".rDate"})
I get the the error: JavaScript runtime error: Object doesn't support property or method 'datepicker'
我得到以下错误: JavaScript runtime error: Object doesn't support property or method 'datepicker'
I'd appreciate any help. 我将不胜感激。
@Scripts.Render("~/bundles/modernizr")
<script src="@Url.Content("~/Scripts/jquery-2.1.0.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.10.4.min.js")" type="text/javascript"></script>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
Use minified version of Jquery and Jquery UI and remove repeated script references. 使用Jquery和Jquery UI的缩小版,并删除重复的脚本引用。
Demo: 演示:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.