Confirmation before deletion of record is very useful to preserve data from accidental record deletion. With confirmation process will be in two steps. Here is the javascript way to ask user whether they want to delete record or not.

<a onclick=”return confirm(‘Are you sure you want to delete?’)” href=”″>Delete</a>

You can see above example. The method is very easy.? if you click OK.. then function will return true and browser navigate href URL otherwise false value will be return and your click will not work.

You can achieve same functionality by wraping above method in a function.

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.