Reputation: 2187
I want to use a confirm box for user to check before submitting the form. I use the following form tag in my script:
<form action="delete.php" method="POST" target="_blank" onsubmit="return confirm(\"Are you sure you want to delete it from the database?\");">
But it is not working, after I click "submit" button, the "delete.php" will be executed. Can anyone help me figure out where I went wrong? I wonder is it because this "confirm" function is some sort of inline style that I need to do some reference in the <head>
tag? Thanks!
Upvotes: 0
Views: 358
Reputation: 21130
onsubmit="return confirm('Are you sure you want to delete it from the database?');"
Tested, and works. I don't think you can escape characters like that in tags.
Upvotes: 1