Alex Rivera | Logout

How to remove close button on the jQuery UI dialog?

Asked 2009-05-22T07:55:41.027
812

How do I remove the close button (the X in the top-right corner) on a dialog box created by jQuery UI?

Edit
Report

2 Answers

90

You can use CSS to hide the close button instead of JavaScript:

.ui-dialog-titlebar-close{
    display: none;
}

If you don't want to affect all the modals, you could use a rule like

.hide-close-btn .ui-dialog-titlebar-close{
    display: none;
}

And apply .hide-close-btn to the top node of the dialog

answered 2009-05-22T07:58:52.143
6

I catch the close event of the dialog box. This code then removes the <div> (#dhx_combo_list):

open: function(event, ui) { 
  //hide close button.
  $(this).parent().children().children('.ui-dialog-titlebar-close').click(function(){
    $("#dhx_combo_list").remove();
  });
},
answered 2009-12-10T09:59:57.707

Your Answer