Solved

Creating a dialog box with buttons on a web page

Posted on 2016-07-28
6
71 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 7

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 9

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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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 9

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 7

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where can I find... 1 32
Html5 Index on a table 7 26
Wordpress plugins not working in html 3 24
Jquery-Javascript setAttribute function help 7 10
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video teaches users how to migrate an existing Wordpress website to a new domain.

772 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