jQuery UI dialog – check if exists by instance method

The latest version of jQuery UI no longer allows you to call UI methods on items that are not initialized yet. I’ve just been wrapping them in an if statement, like:

if ($("#divToBeDialoged").hasClass('ui-dialog-content')) {
    // do whatever
} else {
    // it is not initialized yet
}

Edit: changed class name, thanks @dmnc

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)