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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:39:07+00:00 2026-05-16T10:39:07+00:00

I do get that we easily can set the Close button text to a

  • 0

I do get that we easily can set the Close button text to a variable, using closeText option

$("#dialog").dialog({
    autoOpen: false,
    modal: true,
    closeText: btnCancel, // <-----
    overlay: {
        backgroundColor: '#000',
        opacity: 0.5
    },
    buttons: {
        Close: function() {
            $(this).dialog('close');
        }
    }
});

but how about a custom name?

this does not work 🙁

var btnResetMapping = 'Reset Mapping';

$("#dialog").dialog({
    autoOpen: false,
    modal: true,
    closeText: btnCancel,
    overlay: {
        backgroundColor: '#000',
        opacity: 0.5
    },
    buttons: {
        Close: function() {
            $(this).dialog('close');
        },
        btnResetMapping: function() {  // <-----
            // logic here
        },
    }
});

This can be seen as weird question, but my variable, in the code is:

var btnResetMapping = '<%= Resources.PARbuttons.btnResetMapping %>';

witch is loaded correctly from the Global Resources file, with the correct sentence for the applied localization.

it works fine using:

$("#dialog").dialog({
    autoOpen: false,
    modal: true,
    closeText: btnCancel,
    overlay: {
        backgroundColor: '#000',
        opacity: 0.5
    },
    buttons: {
        Close: function() {
            $(this).dialog('close');
        },
        '<%= Resources.PARbuttons.btnResetMapping %>': function() {  // <-----
            // logic here
        },
    }
});

But I’m refactoring this as place the javascript file in it’s own place (alone file), and I want to, not only do this way (separate HTML from Javascript – It’s a Business Web Aplication that is always loaded from the INTRANET, never using Internet btw) but to understand it.

Thank you.

  • 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-16T10:39:08+00:00Added an answer on May 16, 2026 at 10:39 am

    You can use bracket notation, like this:

    var myButtons = { Close: function() { $(this).dialog('close'); }  };
    myButtons[btnResetMapping] = function() { ...logic here... };
    $("#dialog").dialog({
        autoOpen: false,
        modal: true,
        closeText: btnCancel,
        overlay: {
            backgroundColor: '#000',
            opacity: 0.5
        },
        buttons: myButtons
    });
    

    Just make sure btnResetMapping is defined before this code runs and you’re all set 🙂

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

Sidebar

Related Questions

I want to set a button's id to a variable, so that I can
Given an XDocument instance, how can I easily get a TextReader that represents that
I have a project which is under SVN source control. I can easily set
How do you set a custom MarkupExtension from code? You can easily set if
I get that the (nolock) optimizer hint allows for dirty reads, but under what
I get that asterix is for pointers, and I understand about pointers now. But
I get that error with the following code. anyone know why? function validateAdminInput(){ var
I am deleting segments after they gets indexed then how nutch will get that
So Here is the Problem, I am trying to get that circle to align
Given this code, tableButton = new JButton(new ImageIcon(80F_FG2015.GIF)); how would I get that String

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.