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 3752700
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:16:55+00:00 2026-05-19T09:16:55+00:00

I am trying to create a plugin very that has similar usage to the

  • 0

I am trying to create a plugin very that has similar usage to the jquery ui plugin for dialogs. The usage I am after looks like this

First, to set options for my plugin (with a default action) you could pass in params like this.

$('#myId').dialog({
    value1 : 'someValue',
    value2 : 'anotherValue',
    //...
});

Also, I want to be able to wire-up specific events using “key words”. For instance in jquery.UI you can call this to close a dialog

$('#myId').dialog('close');

My question is how do I setup my plugin so that it does one thing if it is being passed in the settings or it does other things depending on the keywords passed in? I tried looking at some of the jquery ui code but I’m not sure I understand what it’s doing or even where to start to just pull out this functionality.

  • 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-19T09:16:55+00:00Added an answer on May 19, 2026 at 9:16 am

    Have a look at jQuery Plugins/Authoring, specifically Plugin Methods.

    Example:

    (function( $ ){
    
      var methods = {
        init : function( options ) { /* THIS */ },
        show : function( ) { /* IS */ },
        hide : function( ) { /* GOOD */ },
        update : function( content ) { /* !!! */ }
      };
    
      $.fn.tooltip = function( method ) {
    
        // Method calling logic
        if ( methods[method] ) {
          return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
        } else if ( typeof method === 'object' || ! method ) {
          return methods.init.apply( this, arguments );
        } else {
          $.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );
        }    
    
      };
    
    })( jQuery );
    

    Then…

    $('div').tooltip(); // calls the init method
    $('div').tooltip({  // calls the init method
      foo : 'bar'
    });
    $('div').tooltip('hide'); // calls the hide method
    $('div').tooltip('update', 'This is the new tooltip content!'); // calls the update method
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm am trying to create a jQuery plugin that will add new namespace functions
I'm trying to create an eclipse plugin that creates a view with a Tree
I am trying to create a Wordpress MU admin plugin, that will insert some
I'm trying to create a plugin for nopCommerce v2.20 that allows the user to
I am Trying to create Eclipse Plugin which has a composite with two TreeViewer
I'd like to create something similar to the shirt-designer feature found on this site:
I'm trying to create a plugin for Android Mail App. this plugin will filters
I'm trying to create a jQuery plugin and having problems with selecting the DOM.
So I am trying to create a wordpress plugin that stores all the dates
I am trying to create an option transfer plugin for jQuery. I have the

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.