标题栏是 div 对话框的兄弟,因此请尝试:
jQuery("#dialog").prev('.ui-dialog-titlebar').css("background", "red");
仅指定背景颜色是不够的,您需要覆盖由以下规则放置在放置背景图像的标题 div 上的背景。
.ui-widget-header {
border: 1px solid #aaaaaa/*{borderColorHeader}*/;
background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/;
color: #222222/*{fcHeader}*/;
font-weight: bold;
}
但是使用 css 样式会更好。dialogClass
为您要自定义的特定对话框指定 a 。
jQuery("#dialog").dialog({
title: 'Information',
dialogClass: 'info'
});
并为此提供规则并确保您的样式表在 jquery ui 之后加载。
.info .ui-widget-header {
background:red;
}
小提琴