views:

55

answers:

3

can i write custom confirm box in javascript.Instead of 'OK' and 'CANCEL' buttons i want to show 'SAVE' and 'DELETE' buttons.

+3  A: 

Not with the native JavaScript confirm box. You could use one of the many JavaScript UI components that emulate modal dialogs to do this instead.

Here's an example: http://jqueryui.com/demos/dialog/modal-confirmation.html

I've never used this so use at your own risk.

Tim Down
can you give one working example
OddOneOut
+7  A: 

Use the jQuery Dialog Box for this.

Tim Schmelter
A: 
$('confirm text').dialog(
    {
        modal:true, //Not necessary but dims the page background
        buttons:{
            'Save':function() {
                //Whatever code you want to run when the user clicks save goes here
             },
             'Delete':function() {
                 //Code for delete goes here
              }
        }
    }
);

This should work, but you will need to download or link to jQuery and the jQuery UI libraries to run this.

Belinda