Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6475843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:13+00:00 2026-05-25T06:45:13+00:00

I am using jQuery’s UI dialogs and I want to add a custom method.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:45:13+00:00Added an answer on May 25, 2026 at 6:45 am

    As mentioned in my comment, you can inherit from a plugin and extend its methods.

    (function($,undefined) {
    
        $.widget('ui.mydialog', $.ui.dialog,{
            test : function() { alert('works') },
        });
    
        $.extend($.ui.mydialog,{version:'v0.1'});
     })(jQuery);
    

    To use it simply:

    $('.selector').mydialog({modal:true}); //Create (same as a dialog)
    
    $('.selector').mydialog('test');  //Call extended method 
    

    This pattern allows you to add additional input options, methods, events, etc. as well as overload or extend the functions supplied in the parent plugin.

    Should also mention that this is nice because you can still use the regular plugin without modifications elsewhere in your UI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery's dialog I came across the following quirk (tested in FF3): User selects
Using jquery, How can I create multiple draggables using loops through javascript? I want
Using jQuery I want to give a specific element the same width (or min-width
Using jQuery, how can I create a clone of a Row which has display:
Using jQuery validation plugin but it has no CSV validation. I have made an
Using jquery how can one add a black border around all p elements that
Using jQuery I want to check if checkboxes or radio button inside a div
Using jQuery, I want to check if the text of a link I'm clicking
Using jQuery autocomplete.. Want to replace hello in script below with javascript to identify
Using jquery alerts dialog plugin , how do I send a value in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.