How to create a confirm dialog yes no with javascript?

You can use confirm():

var returnDialog = confirm('Do you want to delete the record?')
if (returnDialog) {
   // code case oke
   console.log('click oke');
} else {
   // code case no
   console.log('click no');

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

Add a Comment

Your email address will not be published. Required fields are marked *