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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:52:59+00:00 2026-05-27T16:52:59+00:00

Is there a way to control which buttons to display in a Jquery Dialog?

  • 0

Is there a way to control which buttons to display in a Jquery Dialog?

Scenario:

Perhaps there might be program logic whereby after saving the data, the dialog is then able to show a “Delete” button. (meaning after a form submit within the dialog, the entire dialog refreshes? >> this includes the buttons on the dialog being loaded?)

Any advice?

  • 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-27T16:53:00+00:00Added an answer on May 27, 2026 at 4:53 pm

    You can do this using the getter and setter methods on the buttons options on the jQuery dialog. The following example is taken from the jQuery UI docs:

    //getter
    var buttons = $( ".selector" ).dialog( "option", "buttons" );
    
    //setter
    $( ".selector" ).dialog( "option", "buttons", [
        {
            text: "Ok",
            click: function() { $(this).dialog("close"); }
        }
    ] );
    

    So in your example you could do:

    Adding

    // Get existing buttons
    var buttons = $( ".selector" ).dialog( "option", "buttons" );
    
    // Add a delete button
    buttons.push({
        text: "Delete",
        click: function () {
            // Do your deletion stuff
        }
    });
    
    // Put the modified button Array back in
    $( ".selector" ).dialog( "option", "buttons", buttons );
    

    Removing

    // Get existing buttons
    var buttons = $( "#testDialog" ).dialog( "option", "buttons" );
    
    $.each(buttons, function (i) {
        if (this.text === "Delete") {
            // We've found the button we want to delete so remove it from Array
            buttons.splice(i, 1);
    
            // No point in continuing the loop as we've removed what
            // we want to remove.
            return;
        }
    });
    
    // Put the modified button Array back in
    $( "#testDialog" ).dialog( "option", "buttons", buttons );
    

    Here’s a working example.

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

Sidebar

Related Questions

Is there any (simple) way to get some control of the order in which
Is there a way to control where Resharper puts its backing fields? currently it
Is there a way to control the number of displayed rows in a DropDownList
Is there a way to control the addins Visual Studio 2008 loads via the
Is there a way to control the brightness of the OS X desktop programmatically
Is there a way to control how .Net sets the Name and ID property
Is there a way to control the Maven embedded Tomcat version? mvn tomcat:run This
Is there any way to control and manual specification for start of teaser ?.
Is there a way to control groovy's MarkupBuilder's output and filter out the newline
In Java, is there a way to control the TTL of the IP header

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.