没有任何内容加载到我的jQuery对话框中 [英] Nothing is loaded into my jQuery dialog
本文介绍了没有任何内容加载到我的jQuery对话框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我拥有以下jQuery之前:
Before I had the following jQuery:
var dialogDiv = "<div id='" + dialogId + "'></div>";
$(dialogDiv).load(href, function () {
...
它工作正常。
现在我改变了一点:
var dialogDiv = "<div id='" + dialogId + "' class='modal hide fade'><div class='modal-body'><p class='body'></p></div></div>";
$('.modal-body p.body').load(href, function () {
...
现在没有任何内容加载到我的jQuery对话框中。任何想法?
Now nothing is loaded into my jQuery dialog. Any idea?
谢谢。
推荐答案
问题在于那些元素不是'还存在于DOM中。将其包装在jQuery对象中:
The problem is that those elements don't exist in the DOM yet. Wrap it in a jQuery object:
var $dialogDiv = $("<div id='" + dialogId + "' class='modal hide fade'><div class='modal-body'><p class='body'></p></div></div>");
$dialogDiv.find('.modal-body p.body').load(href, function () {
编辑:最终您必须在DOM中插入该对象。您可以将 insertAfter($ bla)
链接到 load()
事件。
Eventually you'll have to insert that object in the DOM. You can chain insertAfter($bla)
to the load()
event.
这篇关于没有任何内容加载到我的jQuery对话框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文