Reputation: 3571
Code for parent-div dialog:
$("#parent-div").dialog({
title: 'Parent',
width: parseInt(100, 100),
height: parseInt(190, 10),
modal: true,
buttons: [
{
text: "Cancel",
click: function () {
$(this).dialog("close");
}
},
{
text: "Save",
click: function () {
$(this).dialog("close");
}
}
]
});
Code for child-div dialog:
<div id="child-div"></div>
How to insert child div into parent div in Jquery Dialog along with buttons save and cancel which are already added ?
Upvotes: 0
Views: 4424
Reputation: 56509
Try using appendChild() in javascript.
var childDiv = document.getElementById("child-div");
document.getElementById("parent-div").appendChild(childDiv);
Check this JSFiddle
Upvotes: 1
Reputation: 4515
$("#parent-div").append($("#child-div"));
or if you want child-div to be the first element
$("#parent-div").prepend($("#child-div"));
You could string this together with your dialog call like so:
$("#parent-div").dialog({
// your options
}).append($("#child-div"));
Upvotes: 2