create dialog without id and append in jquery

2019-08-05 10:29发布

I have created a div using jquery that i want to make a dialog. I want to append another div in that dialog before opening it. How can i do that??

2条回答
女痞
2楼-- · 2019-08-05 11:09

create new div and apend old div to it to old div

 var newDiv =  $(document.createElement('div')); //Note 1

 $("#ID_OF_OLD_DIV").appendTo($(newDiv));
 $(newDiv).dialog();//or what ever you are using

Nte 1: from this answer

查看更多
淡お忘
3楼-- · 2019-08-05 11:12

You could add a DOM Object into a div with:

$("div#dialog").append("<div></div>");
查看更多
登录 后发表回答