我有一个应用了class = "dialog-error"的 div 。在 jQuery 中,我为这个 div 分配了一个对话框,如下所示:$('.dialog-error').dialog({});
我希望能够仅定位和修改属于我的“对话框错误”类的 ui 类,所以我尝试了:
.dialog-error .ui-dialog-titlebar {
background-color: red;
background-image: none;
color: white;
font-size:small;
}
.dialog-error .ui-dialog-buttonpane {
font-size: 0.8em;
}
但没有一个适用。如何仅针对属于我的类的 UI 类?
我想要实现的是至少有两个不同的类别(如:错误对话和成功对话),并通过更改 div 的类来回切换。非常感谢。
jQuery代码:
$('.dialog-error').dialog({
resizable: false,
height: 200,
width: 350,
modal: true,
dialogClass: "dialog-error", //use this to affect the css
title: "Missing Information!",
buttons: {
"Back": function() {
$(this).dialog("close");
}
}
});
HTML 代码:
<div class = "dialog-error" style = "display:none;"></div>
按照建议添加了'dialogClass: "dialog-error"'行,但现在根本不会显示 ui 对话框。