I am using jQuery's UI dialogs and I want to add a custom method.
Basically when my dialog has a class of 'working', it has a loading overlay in it. I am trying to write some global application jQuery so that when any dialog closes, it removes the class 'working'.
I'm not really sure what I'm doing but this is what I have so far:
(function ($) {
// BIND TO DIALOG CLOSE EVENT
$('.ui-dialog').live('dialogclose', function() {
$(this).dialog('cancelWorking');
});
// CUSTOM METHOD
$.fn.dialog.cancelWorking = function() {
$(this).removeClass('working');
};
}(jQuery));
As you can see I'm not really sure how to call the cancelWorking
method of a dialog, and I'm not sure if I've even defined the method properly.