类型错误: $(..).Live 不是 MVC 中的函数
TypeError: $(...).live is not a function in MVC
我在MVC表单中使用了使用Jquery的对话框。
在我看来:
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function () {
$("#dialog").dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
}
});
$("#opener").click(function () {
$("#dialog").dialog("open");
});
});
</script>
@using (Html.BeginForm())
{
<div id="dialog" title="Basic dialog">
<p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<button id="opener">Open Dialog</button>
}
我尝试使用Firebug进行调试,它显示了错误
TypeError: $(...).live is not a function
$("a[data-ajax=true]").live("click", function (evt) {
当我单击该按钮时,jquery 函数将执行,但它不显示对话框。如何解决此问题?
使用 on 而不是 live,因为您使用的是 jQuery 1.10.2,在此版本中,不推荐使用 live 方法:
$("a[data-ajax=true]").on("click", function (evt) {
相关文章:
- $scw(.eventTracking 不是 Sitecore MVC 中 WFFM 中的函数
- 如何使用 Web 表单(不是 MVC 或 asmx 页面)从 ajax Http POST 获取 c# 服务器端的复选框
- Javascript对象数组到MVC操作几乎不起作用,但不是完全
- jQuery autocomplete - TypeError: autocomplete 不是 asp.net MVC
- 类型错误: $(..).Live 不是 MVC 中的函数
- MVC 控制器操作返回 html 而不是布尔值
- jquery $.ajax 的 MVC 3 反序列化请求 json 到对象中填充空值而不是空白字符串
- 如何在 Web api mvc 项目中使用显示而不是可见性
- 我可以输出 JSON 吗,其中 ID 是键而不是 MVC (C#) 中的数组 ASP.NET
- ASP.NET MVC&Angular:会话到期后,Angular Factory返回登录页面的HTML,而不是
- MVC使用jquery而不是提交按钮
- setRadius:不是数字,MVC 5中的谷歌地图V3
- 在我的asp.net MVC中返回一个只包含java脚本警报的部分视图是不是一个糟糕的设计
- Sencha extjs 5一个文件项目不是MVC
- 我想张贴下拉文本,而不是值在MVC DropdownFor
- 美元.notify不是ajax调用后MVC中的Bootstrap函数
- 文件上传与jquery表单插件和mvc 3是不填写与我的部分视图的目标属性
- 数组不是从视图MVC传递给控制器的
- 我应该在asp MVC中使用不显眼的javascript而不是编写自己的验证代码吗?
- javascript调用的类似MVC动作,AntiForgery只在其中一个上工作,而不是另一个