使用Ajax加载内容时,使JQUERY对话框正常工作 [英] Get JQUERY Dialog working when loading content with ajax

查看:87
本文介绍了使用Ajax加载内容时,使JQUERY对话框正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下jquery代码:

I have the following jquery code:

$(".editDialog").dialog({
    autoOpen: false,
    show: {
        effect: "blind",
        duration: 1000
    },
    hide: {
        effect: "explode",
        duration: 1000
    }
});

我有几个带有class ="editDialog"的<div>元素. 一切都很好,但是当我用ajax加载这些div时.对话框不再起作用.

I have several <div> elements with class="editDialog". Everything works very well, but when i load these div's with ajax. The dialogs doesn't work anymore.

JSFIDDLE: http://jsfiddle.net/9Wvte/

JSFIDDLE: http://jsfiddle.net/9Wvte/

它在这里工作.但是当HTML节中的代码由ajax加载时,它将停止工作.

Here it is working. But when the code in the HTML Section is loaded by ajax, it stops working.

我认为我必须更改上面的代码,以便即使在调用document.ready之后也可以调用它.

I think i have to change the code above, so that it is called even after document.ready was called.

推荐答案

complete : function(){
/*your function here*/
}

在您的Ajax POST函数中

.根据我的说法,偶数是在DOM中创建元素之前绑定的.在ajax加载DOM之后,在此处运行该函数将触发该函数,因此它将绑定到所有元素.

in your ajax POST function. According to me the even is bound before the elements are created in the DOM. Running the function here will trigger it after the ajax has loaded the DOM hence it will be bound to all the elements.

这篇关于使用Ajax加载内容时,使JQUERY对话框正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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