Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript C#4.0
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 25-Jan-13 8:08am
Comments
Abhishek Pant at 25-Jan-13 14:37pm
   
use modal popup

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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?" Smile | :)
  Permalink  
v2
Comments
MacIntyre at 25-Jan-13 15:45pm
   
Would this work instead:
$.prompt('Example 4',{ buttons: { Ok: true, Cancel: false }, focus: 1 });
Zoltán Zörgő at 25-Jan-13 16:28pm
   
Give it a try :)
Sergey Alexandrovich Kryukov at 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)



Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100