Solved

Creating a dialog box with buttons on a web page

Posted on 2016-07-28
6
58 Views
Last Modified: 2016-08-13
Hi,
In my web application when a user clicks on close button i want a box to appear with following content :
Text : Changes you made will not be saved
Buttons :
1) Close
2) Don’t close

I tried using the window.confirm  It shows dialog like :
Screen-Shot-2016-07-29-at-12.13.59-P.pngI couldnt find how to change the names of the buttons.
Some places its mentioned that you cannot change it. What alternative ways are there ?

Thanks
0
Comment
Question by:Rohit Bajaj
  • 2
  • 2
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
Mukesh Yadav earned 250 total points
ID: 41734223
Yes this is not possible to change these values.

To use something different you can go with Bootbox confirm method.
0
 
LVL 8

Assisted Solution

by:Paweł
Paweł earned 250 total points
ID: 41734224
if you are using the front end just use the jquerUI modal dialog

https://jqueryui.com/dialog/#modal-confirmation, it'll be more work, but yes as far as i know you can't modify the buttons in a window.confirm, just like you cant change then button on the alert.
0
 

Author Comment

by:Rohit Bajaj
ID: 41734587
Is jquery UI installable while npm ?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:Rohit Bajaj
ID: 41734624
I tried using require("jquery-ui");
installed it using npm install jquery-ui.
But getting error on this line :     $("#dialog").dialog({ autoOpen: false });
TypeError: $(...).dialog is not a function
On this sample page : http://api.jqueryui.com/dialog/#entry-examples
They are using 3 jquery related libraries.
for jquery i am already using 2.1.4 version.
0
 
LVL 8

Expert Comment

by:Paweł
ID: 41734628
I don't think you've included jqueryUI correctly

https://www.npmjs.com/package/jquery-ui
https://forum.jquery.com/topic/how-can-i-install-jquery-ui-1-11-4-with-npm

i think you're going to have to download Jquery UI and add it manually.

I should also mention i'm not familiar with NPM
0
 
LVL 6

Expert Comment

by:Mukesh Yadav
ID: 41753787
Hi Rohit,

Can you please close this question by accepting a solution, If current answers doesn't work for you please tell us what issue  you are facing.

Thanks,
Mukesh Yadav
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to dynamically set the form action using jQuery.

708 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

12 Experts available now in Live!

Get 1:1 Help Now