I've been attempting to assign the CSS class .dialogStyle to a dialog box, but for some reason, it doesn't seem to be taking effect.
<!doctype html>
<head>
<meta charset="utf-8" />
<title>Test</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<style>
.dialogStyle .ui-dialog { font-size: 62.5%;
background-color: red;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(document).ready(function() {
$( "#update-dialog" ).dialog({
autoOpen: false,
dialogClass: 'dialogStyle',
resizable: false,
height:140,
modal: true,
buttons: {
"Update": function() {
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
$(".update-button").click(function () {
$("#update-dialog").dialog("open");
});
});
</script>
</head>
<body>
<div id="update-dialog" title="Update COMMON_NAME">
<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>
<button class="update-button">Update COMMON_NAME</button>
<p>Sed vel diam id libero <a href="http://example.com">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.</p>
</body>
</html>
The issue persists where the CSS is not being applied to the ui-dialog as expected. Interestingly enough, substituting ".ui-dialog" with ".ui-dialog-titlebar" does offer some styling (specifically to the titlebar).
<style>
.dialogStyle .ui-dialog-titlebar { font-size: 62.5%;
background-color: red;
}
</style>
I'm puzzled as to why setting dialogClass doesn't affect .ui-dialog but does impact .ui-dialog-titlebar. According to this resource (refer to section titled "Theming"), both .ui-dialog and .ui-dialog-titlebar are classes of the dialog box.