Execute javascript code straight before page submit

Something like this?

<form onsubmit="do_something()">

function do_something(){
   // Do your stuff here
}

If you put return like the code below, you can prevent the form submission by returning false from the do_something() function.

<form onsubmit="return do_something()">

function do_something(){
   // Do your stuff here
   return true; // submit the form

   return false; // don't submit the form
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)