• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 114
  • Last Modified:

Creating a dialog box with buttons on a web page

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
Rohit Bajaj
Asked:
Rohit Bajaj
  • 2
  • 2
  • 2
2 Solutions
 
Mukesh YadavFull Stack DeveloperCommented:
Yes this is not possible to change these values.

To use something different you can go with Bootbox confirm method.
0
 
PawełI Design & Develop SoftwareCommented:
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
 
Rohit BajajAuthor Commented:
Is jquery UI installable while npm ?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Rohit BajajAuthor Commented:
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
 
PawełI Design & Develop SoftwareCommented:
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
 
Mukesh YadavFull Stack DeveloperCommented:
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
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

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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