Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to develop yes no confirmation using jquery

How to develop confirmation dialog with yes no button using jquery or any other method ? I need that confirmation when I click on submit button.

like image 809
chetan Avatar asked Jul 02 '10 13:07

chetan


People also ask

How do I get Yes No confirmation box in jQuery?

okButton = 'Yes'; jQuery. alerts. cancelButton = 'No'; jConfirm('Are you sure?? ', '', function(r) { if (r == true) { //Ok button pressed... } }

How do I make a yes no alert in HTML?

You can create a JavaScript confirmation box that offers yes and no options by using the confirm() method. The confirm() method will display a dialog box with a custom message that you can specify as its argument.

How do I make a confirmation box in HTML?

The confirm() method displays a dialog box with a message, an OK button, and a Cancel button. The confirm() method returns true if the user clicked "OK", otherwise false .

How do you use confirm in JavaScript?

The confirm() method is used to display a modal dialog with an optional message and two buttons, OK and Cancel. It returns true if the user clicks “OK”, and false otherwise. It prevents the user from accessing other parts of the page until the box is closed. message is the optional string to be displayed in the dialog.


2 Answers

Use the native browser confirm dialog.

if(confirm("Are you sure?"))
{
    //Ok button pressed...
}
else
{
    //Cancel button pressed...
}
like image 68
mck89 Avatar answered Nov 09 '22 14:11

mck89


I have a solution, it is working for me.

     $.alerts.okButton = ' Yes ';
     $.alerts.cancelButton = ' No ';                  
     jConfirm('Are you sure??',  '', function(r) {
       if (r == true) {                    
          //Ok button pressed...
       }  
     });
like image 27
Sushanth CS Avatar answered Nov 09 '22 13:11

Sushanth CS