Create JavaScript Confirm Box for Record Deletion

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=”page.page?act=delete&id=1″>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.


Read Related Post

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply