To get a dialog's parent container, try this:
var d = $('#dialog');
var parent = d.dialog('dialog').parent();
By default, the dialog will be created and moved to <body>. If you want to let the dialog stay on its original position, please set 'inline' property to true.