How to show a confirmation message before delete with JavaScript?

Spread the love

Sometimes, we want to show a confirmation message before delete with JavaScript.

In this article, we’ll look at how to show a confirmation message before delete with JavaScript.

How to show a confirmation message before delete with JavaScript?

To show a confirmation message before delete with JavaScript, we call the confirm function.

For instance, we write

const result = confirm("Want to delete?");
if (result) {
  //...
}

to call confirm with the message for the confirm box.

And then if we click OK, confirm is true.

Conclusion

To show a confirmation message before delete with JavaScript, we call the confirm function.

Leave a Reply

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