Skip to content

Commit 25e9973

Browse files
committed
Dialog: Add example of how to hide the close button. Fixes jquery#78.
1 parent 7586dfb commit 25e9973

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

entries/dialog.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,32 @@
99

1010
<p>A bottom button bar and semi-transparent modal overlay layer are common options that can be added.</p>
1111

12+
<h3>Hiding the close button</h3>
13+
14+
<p>In some cases, you may want to hide the close button, for instance, if you have a close button in the button pane. The best way to accomplish this is via CSS. As an example, you can define a simple rule, such as:</p>
15+
16+
<pre><code>
17+
.no-close .ui-dialog-titlebar-close {
18+
display: none;
19+
}
20+
</code></pre>
21+
22+
<p>Then, you can simply add the <code>no-close</code> class to any dialog in order to hide it's close button:</p>
23+
24+
<pre><code>
25+
$( "#dialog" ).dialog({
26+
dialogClass: "no-close",
27+
buttons: [
28+
{
29+
text: "OK",
30+
click: function() {
31+
$( this ).dialog( "close" );
32+
}
33+
}
34+
]
35+
});
36+
</code></pre>
37+
1238
<h3>Dependencies</h3>
1339
<ul>
1440
<li><a href="/category/ui-core/">UI Core</a></li>

0 commit comments

Comments
 (0)