Javascript 在文档根目录jQuery中添加一个对话框

Javascript 在文档根目录jQuery中添加一个对话框,javascript,jquery,jquery-ui,jquery-selectors,Javascript,Jquery,Jquery Ui,Jquery Selectors,在此对话框中,对话框被添加到#对话框确认元素中。但是我希望它只添加到主体中,并且我不希望在html中有任何预定义的div#dialog confirm元素。那么我是如何认识到这一点的呢 您可以简单地使用$('body')将文档体对象封装在jQuery包装中,并执行此操作。您可以动态添加div#对话框确认 $(document.documentElement).append('<div id="dialog-confirm" title="Empty the '+ 'recycle b

在此对话框中,对话框被添加到#对话框确认元素中。但是我希望它只添加到主体中,并且我不希望在html中有任何预定义的div#dialog confirm元素。那么我是如何认识到这一点的呢

您可以简单地使用
$('body')
将文档体对象封装在jQuery包装中,并执行此操作。

您可以动态添加div#对话框确认

$(document.documentElement).append('<div id="dialog-confirm" title="Empty the '+
   'recycle bin?"<p><span class="ui-icon ui-icon-alert" style="float:left; ' +
   'margin:0 7px 20px 0;"></span>These items will be permanently deleted and' +
   ' cannot be recovered. Are you sure?</p></div>');

$( "#dialog-confirm" ).dialog();

$(document.documentElement).append('谢谢这对我来说很有用,但它看起来不像jquery对话框,它几乎没有css格式您添加了UI样式表吗
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/base/jquery-ui.css
I add href=“/js/jquery/css/custom-theme/jquery-ui-1.8.4.custom.css”,似乎是正确的。我在上面添加了一个屏幕截图。请参见此
http://jcubic.pl/test.html
看起来不错。对话框有灰色样式,有标题栏和图标。