Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The Confirm dialog described in http://www.w3schools.com/jsref/met_win_confirm.asp[^] contains Yes and No buttons. Now, I need to customize the words of the 2 buttons. For instance the 'Yes' is worded as 'Do xxx' and 'No' is worded as 'Do yyy'. How to do it? Thanks if you can help.
Posted
Comments
Afzaal Ahmad Zeeshan 1-Apr-15 10:49am    
You will have to create your own custom dialog.

You cannot do this with the confirm method, so there are two options:

  1. Create your own dialog.
  2. Look for a library that contains dialogs. For example, jQuery UI has support for modal dialogs[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 1-Apr-15 10:58am    
5ed.

Congratulations with 1st of April!

I would like to invite your to see my new 1 of April publication and have some fun:
Some Programming Approaches to "Neuro-Linguistic Programming".
Participation in this game in Comments and Discussions is especially encouraged.

Thank you.
—SA
Thomas Daniels 1-Apr-15 11:19am    
Thanks!

Awesome article :)
Sergey Alexandrovich Kryukov 1-Apr-15 11:43am    
I'm glad you find it funny? :-)
Thank you.
—SA
The link you referred to is the built-in confirm() function. You cannot change that.

What you'll want to do is google for jQuery dialog examples. There are tons and tons of them. Or you can just build your own div and use JS to do it but there are lots of nice jQuery plugins that make dialogs easy to do.
 
Share this answer
 
This embedded JavaScrip dialog has two problems: it pop-ups over the page (inconvenient), looks ugly, depends on the browser/system and is not flexible.

One better solution is the jQuery UI dialog which implement modal behavior within the page: https://jqueryui.com/dialog[^].

You can also use one of the many 3rd-party jQuery UI plug-ins based on similar principle and offering all kinds of visual effects and options, notably, dimming the rest of the page. Such solutions are usually referred by the common name "modal popup" You will find more than enough of them: http://bit.ly/1DpajUJ[^].


Congratulations with 1st of April! :-)

I would like to use the occasion to invite everyone to see my new 1 of April publication and have some fun:

Some Programming Approaches to "Neuro-Linguistic Programming".
Participation in this game in Comments and Discussions is especially encouraged.

Thank you.
—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900