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

  • Home
  • SEARCH
  • 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 6640929
In Process

The Archive Base Latest Questions

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

See Edit below initial question for a revised version of the original problem Using

  • 0

See Edit below initial question for a revised version of the original problem

Using a jquery-ui dialog I want to be able to specify the label on the button dynamically.

To do this I’m specifying an array of buttons like this :

var arrbuttons = {};
arrbuttons.cancel = function() { alert('test1');};
arrbuttons.update = function() { alert('test2');};
    $(function() {
      $( "#dialog" ).dialog({buttons: arrbuttons});
    });

I got that from this stackoverflow answer and it works fine as far as it goes.

What I would like to know now is how I can setup the array so the label of each button is specified for each element of ‘arrbuttons’.

The jquery-ui documentation shows how to do this with an inline array like this :

$( ".selector" ).dialog({ buttons: [
    {
        text: "Ok",
        click: function() { $(this).dialog("close"); }
    }
] });

But there’s no example in the jquery doco which corresponds to the answer I’m basing my attempt on.

Anyone know ?


OK I’ve now worked on this a little more. By doing the following I can specify the text of the buttons. The trouble is the function part no longer works (ie the buttons are labelled ‘wow!’ and ‘kapow!’ but when you click on them nothing happens.

var arrbuttons = {};
arrbuttons.cancel = {click: "function() { alert('test1');}", text:"wow!"};
arrbuttons.update = {click: "function() { alert('test2');}", text:"kapow!"};
$(function() {
    $( "#dialog" ).dialog({buttons: arrbuttons});
});

Any ideas of how to do this ?

  • 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-25T23:45:05+00:00Added an answer on May 25, 2026 at 11:45 pm

    remove the double quotes around function statement

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

Sidebar

Related Questions

EDIT: See my answer below for the hotfix. ORIGINAL QUESTION: In setting up for
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
EDIT: See my working code in the answers below. In brief: I have a
I have a Controller with two Edit methods (see below). When I submit the
I receive this message (see image below) when I try to edit in debugging.
Edit: I have solved this by myself. See my answer below I have set
Intro: EDIT: See solution at the bottom of this question (c++) I have a
EDIT: See this in action here: http://jsbin.com/emobi/5 -- and that's using mouseenter/mouseleave. I have
See below: Edit.aspx View: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage<Test.Models.Friend> %> Edit <h2>Edit</h2> <%
Java's default encoding is ASCII . Yes? (See my edit below) When a textfile

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.