Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQueryUI Dialog - style not generated for buttons

Tags:

jquery-ui

I use the the following code to show a dialog with jQuery UI:

var $dialog = $('<div></div>')
.text(msg)
.dialog({
    autoOpen: false,
    height: 140,
    modal: true,
    title: "Confirm",
    buttons: {
        "Yes": function() {
            $(this).dialog('close');
        },
        "Cancel": function() {
            $(this).dialog('close');
        }
    }
});
$dialog.dialog('open');

However, the buttons have no styles. I notice that the HTML generated for the buttons are:

<div class="ui-dialog-buttonset">
    <button>Yes</button>
    <button>Cancel</button>
</div>

From the jQuery UI demos it is:

<div class="ui-dialog-buttonset">
    <button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Ok</span></button>
    <button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Cancel</span></button>
</div>

I.e. the CSS styles are missing. Do you know why?

like image 737
xhh Avatar asked Nov 08 '10 07:11

xhh


1 Answers

If you use Bootstrap and JQueryUI, jquery-ui.js must be included AFTER bootstrap.js.

like image 134
Oleksandr V. Kukliuk Avatar answered Sep 19 '22 18:09

Oleksandr V. Kukliuk