JQuery ui close button not appearing in dialog

JQuery UI Close Button not showing

I didn’t like going through all the fixes proposed by the other websites where you have to change the JQuery UI file. I preferred adding the following line to the file that I’m using:

if($(".ui-dialog-titlebar-close .close").length==0)
               $(".ui-dialog-titlebar-close").append('<div style="position:relative;top:-3px;" class="close">X</div>');

The if($(“.ui-dialog-titlebar-close .close”).length==0)  checks if the close button is already added.

And the  $(“.ui-dialog-titlebar-close”).append(‘<div style=”position:relative;top:-3px;”>X</div>’);  appends and div containing X to display.

If the close button is not showing somewhere else, you could just change the .ui-dialog-titlebar-close  according to what you need.

Leave a Reply