MVC4 jQuery UI的不工作 [英] MVC4 jQuery UI does not work

查看:137
本文介绍了MVC4 jQuery UI的不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能让jQuery UI的在我的ASP.NET应用程序MVC4工作。我试图对话和日期选择器。
这是我认为的code的一部分。

I cannot get jQuery UI working in my ASP.NET MVC4 application. I tried dialog and datepicker. Here is part of the code of my view.

<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
    alert('A');
    //$('#datepicker').val('test');
    $('#datepicker').datepicker();
    alert('B');
});
</script>
<h1>Test</h1>
<form id="testForm" action="#" method="get">
    <input type="text" id="datepicker" name="datepicker" class="datepicker" />
</form>

显示警告A.当我取消下一行,值测试分配。但是,日期选择器不能正常工作和警报B不显示。

The alert A is displayed. When I uncomment the next row, the value test is assigned. But datepicker is not working and alert B does not display.

谢谢,
切赫

推荐答案

在layout.cshtml认为,移动

In the layout.cshtml view, move

@Scripts.Render("~/bundles/jquery") 

从身体到头部和头加太多

from body to head and add in head too

@Scripts.Render("~/bundles/jqueryui")

这篇关于MVC4 jQuery UI的不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆