How to Add confirmation dialog for delete button?

I want this kinda image for the following link

You can use the native JS function confirm, which produces a dialogue box similar to the alert function. If ‘OK’ is pressed, it will return true. Otherwise it returns false. You can combine it with an if statement to get the behaviour you require. See for more.

However, styling the dialogue box involves writing the confirm function from scratch according to A better way to deal with this would be to use a library like SweetAlert