javascript - HTML5 form button onsubmit not working -


i have simple form 2 html5 buttons. each button submits form different php page. working well, 'onsubmit' function never triggered. want show dialog box before delete.php page called.

<form method="post">       <input type="text" name="fname">        <!-- html5 formaction -->       <button type="submit" name="update" formaction="update.php">update</button>       <button type="submit" name="delete" onsubmit="return confirm('do want delete?');" formaction="delete.php">delete</button>   </form> 

i have tried different variations, javascript code never triggered. why?

try this

<form method="post">       <input type="text" name="fname">        <!-- html5 formaction -->       <button type="submit" name="update" formaction="update.php">update</button>       <button type="button" name="delete" onclick="return delete();" formaction="delete.php">delete</button>   </form>  <script> function delete(){  if(confirm('do want delete?')){ // delete code } return false; } </script> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -