Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am calling the confirm("Are you sure you want to delete");
then I get the standard "Ok" and "Cancel" buttons with "Ok" as the default.

Because this is a delete is there a way, other than creating a custom dialog box, the change the default button to be the "Cancel" button? Or even reverse the text of the boxes?

Thanks..
Posted
Comments
Abhishek Pant 25-Jan-13 14:37pm    
use modal popup

1 solution

Unfortunately, there is no way to influence the appearance and the behavior of the built-in dialog.

So you either make a custom dialog with jquery for example[^], or you change the question formulation to have the godd default button: instead of "Are you sure you want to delete this?" ask "Would you better keep this?" :)
 
Share this answer
 
v2
Comments
MacIntyre 25-Jan-13 15:45pm    
Would this work instead:
$.prompt('Example 4',{ buttons: { Ok: true, Cancel: false }, focus: 1 });
Zoltán Zörgő 25-Jan-13 16:28pm    
Give it a try :)
Sergey Alexandrovich Kryukov 25-Jan-13 17:03pm    
Actually, jQuery dialogs or modal windows (don't mix them up with those evil pop-ups!) make a lot of sense. It's always better to prefer lightweight components and get rid of build-in alert or confirm. Those dialogs do not belong the page. My 5.
—SA

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