开发者

Removing DIVs in a jquery dialog

开发者 https://www.devze.com 2023-02-03 21:40 出处:网络
I have a dialog window that uses a URL for its开发者_开发知识库 contents { function(){jQuery.ajax({\'success\':function(html) {

I have a dialog window that uses a URL for its开发者_开发知识库 contents

{

function(){jQuery.ajax({'success':function(html) {
        jQuery('#menu_dialog').html(html);
        $('#menu_dialog').dialog('open');
        $('#header').hide();
       },'url':'/testing/index.php/menu','cache':false});return false;};

}

What happens is that it was displaying the whole page, including the header, the footer,navigation menu,etc. What I want is for the dialog to only display the content inside the <content> tag.

How can I remove the unnecessary divs in the dialog window?


Rather than taking your data and using it directly, get only what you need:

// you had: jQuery('#menu_dialog').html(html);
var newPage = jQuery(html);
jQuery('#menu_dialog').empty().append(newPage.find('#content'));


I think this might work

$("#menu_dialog").children().not("content").remove();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号