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.
okButton = 'Yes'; jQuery. alerts. cancelButton = 'No'; jConfirm('Are you sure?? ', '', function(r) { if (r == true) { //Ok button pressed... } }
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.
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 .
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.
Use the native browser confirm dialog.
if(confirm("Are you sure?"))
{
//Ok button pressed...
}
else
{
//Cancel button pressed...
}
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...
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With