jQuery UI dialog插件出错信息:$(this).dialog is not a function
2016-02-19 11:07
295 查看
使用jQuery UI 1.7.2 dialog插件,遇到这样的错误:
$("#dialog").dialog({
width: 480,
height:"auto",
resizable: false,
draggable: true,
modal: true,
position: "center",
autoOpen: false,
dialogClass: "dialog",
buttons: {"关闭":function(){
$(this).dialog("close");
}}
});
$("#chglogpwd").bind("click",function(){
$("#dialog").dialog("option","height","400");
showModalDialog("#dialog","/accoun/acc/change_logpwd_fm.html?"+new Date().getTime(),"修改登录密码");
});
function showModalDialog(dialogEl,url,title,callback){
var $this = $(dialogEl);
$this.html("");
$this.dialog("option","title",title);
$this.dialog("open");
$this.load(url).removeClass("hideh");
}
调试了很久,发现在当前页面上加载了jquery的js资源,在被load的那个页面中也加载了jquery的资源。
<script type="text/javascript" src="/common/js/jquery-1.4.2.min.js"></script>
尝试将被load的页面中的jquery资源去除,错误便消除。
经测试:asp.net mvc 1.0/2.0不会出现此错误,但是mvc 3.0中就会出现此错误
$("#dialog").dialog({
width: 480,
height:"auto",
resizable: false,
draggable: true,
modal: true,
position: "center",
autoOpen: false,
dialogClass: "dialog",
buttons: {"关闭":function(){
$(this).dialog("close");
}}
});
$("#chglogpwd").bind("click",function(){
$("#dialog").dialog("option","height","400");
showModalDialog("#dialog","/accoun/acc/change_logpwd_fm.html?"+new Date().getTime(),"修改登录密码");
});
function showModalDialog(dialogEl,url,title,callback){
var $this = $(dialogEl);
$this.html("");
$this.dialog("option","title",title);
$this.dialog("open");
$this.load(url).removeClass("hideh");
}
调试了很久,发现在当前页面上加载了jquery的js资源,在被load的那个页面中也加载了jquery的资源。
<script type="text/javascript" src="/common/js/jquery-1.4.2.min.js"></script>
尝试将被load的页面中的jquery资源去除,错误便消除。
经测试:asp.net mvc 1.0/2.0不会出现此错误,但是mvc 3.0中就会出现此错误
相关文章推荐
- JQuery获取select值
- jquery点击图片选中特效
- jquery.dataTables--插件使用方法
- DateTimePicker:jQuery日期和时间插件
- jquery.validate使用 - 常用验证脚本
- jquery获取元素宽高,浏览器宽高,滚动距离
- jQuery ajax请求方法汇总
- jQuery on()绑定动态元素出现的问题小结
- web前端基础——jQuery编程基础
- Jquery取值简介(radio,select,checkbox)
- jQuery fancybox在ie浏览器下无法显示关闭按钮的解决办法
- 45个炫酷的jquery图片滚动插件
- jQuery数组($.each,$.grep,$.map,$.merge,$.inArray,$.unique,$.makeArray)处理函数详解
- 关于jQuery的inArray 方法介绍
- JQuery 验证插件validate的showErrors参数的使用
- jQuery fancybox在ie浏览器下无法显示关闭按钮的解决办法
- jQuery on()绑定动态元素出现的问题小结
- jQuery实现简单的DIV拖动效果
- 使用jQuery的easydrag插件实现可拖动的DIV弹出框
- jQuery+PHP+MySQL实现无限级联下拉框效果