Testing if jQueryUI has loaded

if (jQuery.ui) {
  // UI loaded
}

OR

if (typeof jQuery.ui != 'undefined') {
  // UI loaded
}

Should do the trick


You need to check if both, the jQuery UI Library file and CSS Theme are being loaded.

jQuery UI creates properties on the jQuery object, you could check:

jQuery.ui
jQuery.ui.version

To check if the necessary CSS file(s) are loaded, I would recommend you to use Firebug, and look for the theme files on the CSS tab.

I've seen problems before, when users load correctly the jQuery UI library but the CSS theme is missing.


I know this is an old question, but here is a quick little script you can use to wrap all your jQuery UI things that don't have an associated event to make sure they get executed only after jQuery UI is loaded:

function checkJqueryUI() {
    if (typeof jQuery.ui != 'undefined') {
        do_jqueryui();
    }
    else {
        window.setTimeout( checkJqueryUI, 50 );
    }
}
// Put all your jQuery UI stuff in this function
function do_jqueryui() {
    // Example:
    $( "#yourId" ).dialog();
}
checkJqueryUI();