Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 115
  • Last Modified:

How to change buttons on JQuery modal dialog box.

This is the exact code I am using to display a JQuery dialog box. It works great, however it displays two buttons. One labeled "Yes" and another labeled "No". I only need one button on
the Dialog box, and I need it to be labeled as "Ok". Is there any way to only have one button, and to have the text read as "Ok". How can I do that?

function displayDialogBox() {
 $('<div></div>').appendTo('body')
  .html('<div><h6>Alert </h6>
   .dialog({
                      modal:true, title: 'Did not perform process', zIndex:10000, autoOpen: true,
                      width: '600', resizable: false,
                      buttons: {
                                        Yes: function() {
                                         $(this).dialog("close");
                                          Reset();
                                       },
                                       No: function() {
                                         $(this).dialog("close");
                                                       Reset();
                                       }
                                   });

function Reset()
{
   // Code not shown
}
0
brgdotnet
Asked:
brgdotnet
  • 3
  • 2
1 Solution
 
Branislav BorojevicFounderCommented:
From what I can see in the code, all you need to do is remove the
,
                                       No: function() {
                                         $(this).dialog("close");
                                                       Reset();
                                       }

Open in new window

from your code.

Try replacing the code with this:

function displayDialogBox() {
 $('<div></div>').appendTo('body')
  .html('<div><h6>Alert </h6>
   .dialog({
                      modal:true, title: 'Did not perform process', zIndex:10000, autoOpen: true,
                      width: '600', resizable: false,
                      buttons: {
                                      OK: function() {
                                         $(this).dialog("close");
                                          Reset();
                                       }
                                   });

function Reset()
{
   // Code not shown
}

Open in new window

0
 
brgdotnetcontractorAuthor Commented:
Hello Sir, I tried that earlier today, and it did not work. Possibly someone else has a recommendation.
0
 
Branislav BorojevicFounderCommented:
Can you reveal more of the code?

What is the alert for?

Maybe I can suggest a different solution to get the same result.

SIncerely,

Branislav
0
 
brgdotnetcontractorAuthor Commented:
Thank you Sir. I will try some things and get back with you.
0
 
brgdotnetcontractorAuthor Commented:
Thank you. I think the Capitalization of the OK, (Instead of Ok) did the trick. Not sure. It works now though. I will dig into the guts of the code on Monday. Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now