create dialog without id and append in jquery

谁说胖子不能爱 提交于 2019-12-11 05:19:28

问题


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??


回答1:


You could add a DOM Object into a div with:

$("div#dialog").append("<div></div>");



回答2:


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



来源:https://stackoverflow.com/questions/1377523/create-dialog-without-id-and-append-in-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!