Solved

How to change buttons on JQuery modal dialog box.

Posted on 2016-07-28
5
41 Views
Last Modified: 2016-07-29
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
Comment
Question by:brgdotnet
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
Branislav Borojevic earned 500 total points
ID: 41733979
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
 
LVL 2

Author Comment

by:brgdotnet
ID: 41734116
Hello Sir, I tried that earlier today, and it did not work. Possibly someone else has a recommendation.
0
 
LVL 4

Expert Comment

by:Branislav Borojevic
ID: 41734140
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
 
LVL 2

Author Comment

by:brgdotnet
ID: 41734657
Thank you Sir. I will try some things and get back with you.
0
 
LVL 2

Author Closing Comment

by:brgdotnet
ID: 41735423
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now