[英]jquery: On loading dialog from another page & adding it to a DIV, i need only the dialog area to be added?
I'm loading a dialog from another page using load. 我正在使用load从另一个页面加载对话框。 I'm trying to load it inside a DIV.
我正在尝试将其加载到DIV中。 Now i need only the dialog box area to be added inside my div , not the entire blank space that are present in the page from which i load the dialog.
现在,我只需要在div内添加对话框区域,而不需要从中加载对话框的页面中存在的整个空白区域。 how can it be done ?
如何做呢 ?
$(document).ready(function(e) {
$('#content').load('dialog.html');
});
HTML 的HTML
<div id="content">
</div>
Dialog.html Dialog.html
$(document).ready(function(e) {
$('#wrapper').dialog({
appendTo:'#content'
});
});
<body>
<div id="wrapper">
</div>
</body>
i tried load('dialog.html div')
, but still the blank space also gets added ! 我尝试了
load('dialog.html div')
,但仍然会添加空格!
You may try this: 您可以尝试以下方法:
$(document).ready(function(e) {
// initialize dialog
var dialog1 = $("#content").dialog({
autoOpen: false
});
// load content and open dialog
dialog1.load('dialog.html #wrapper').dialog('open');
});
如果您只是想加载“包装器div”,请使用此$("#content").load("dialog.html #wrapper");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.