Javascript [delete] confirmation

Meant to post this aaaaages ago in case I forgot where I found it originally, but of course I didn’t and so today I’ve had to dig around and find it again :)

This snippet of code pops up a confirmation dialog when, for example, you click a button on a web based form, making it ideal for building interfaces where you want to provide a preventative measure against accidental requests being made.

Check it out:


And here’s the code:

<input name=action type=submit value=Delete onClick="javascript:return confirm('Are you sure you want to delete this record?')"/>

Obviously you’ll need to set up methods for handling the different actions, but the key thing here is the javascript snippet.

Credit to CodeToad for the original posting.

2 thoughts on “Javascript [delete] confirmation

  1. Ramchandra

    I have to show thanks to the wrteir for bailing me out of this issue. Just after exploring through the the web and obtaining tips that were not pleasant, I thought my life was well over. Living minus the strategies to the difficulties you have solved all through your main posting is a crucial case, and the kind which may have negatively affected my entire career if I hadn’t noticed your blog. Your primary skills and kindness in controlling the whole lot was useful. I’m not sure what I would’ve done if I had not come across such a subject like this. It’s possible to at this moment relish my future. Thanks a lot very much for this high quality and sensible guide. I will not hesitate to refer your web site to any person who needs to have guide on this issue.

Leave a Reply

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