I have modified jquery-ui Dialog source code to add an option that
allows to hide the close Button. Very handy for various cases.
I use jQuery UI Dialog 1.11.2
Here is the code:
/*
FIRST - Add the option in jquery-ui source code
*/
- options: {
-
hideCloseButton: false,
- .....
/*
THEN - Add the condition
*/
- //
support: IE
- //
Use type="button" to prevent enter keypresses in
textboxes from closing the
- //
dialog in IE (#9312)
- if(
this.options.hideCloseButton )
- {
-
this.uiDialogTitlebarClose = $(
"<span></span>" );
- }
- else
- {
-
this.uiDialogTitlebarClose = $( "<button
type='button'></button>" )
-
.button({
-
label: this.options.closeText,
-
icons: {
-
primary: "ui-icon-closethick"
-
},
-
text: false
-
})
-
.addClass( "ui-dialog-titlebar-close" )
-
.appendTo( this.uiDialogTitlebar );
-
this._on( this.uiDialogTitlebarClose, {
-
click: function( event ) {
-
event.preventDefault();
-
this.close( event );
-
}
-
});
- }
/*
LAST - Use it in a dialog
*/
- $('#dialog').dialog({
-
hideCloseButton: true
- })
Please feel free to use it and give feed back.