http://stackoverflow.com/questions/3384960/want-html-form-submit-to-do-nothing
keywordnya: form no action onsubmit
keywordnya: form no action onsubmit
Menggunakanreturn false;
di javascript
that you call from the submit button, you can stop the form from submitting.
Basically, you need the following HTML:
Then the supporting javascript:<form onsubmit="myFunction(); return false;"> <input type="submit" value="Submit"> </form>
If you desire, you can also have certain conditions allow the script to submit the form:<script language="javascript"><!-- function myFunction() { //do stuff } //--></script>
Paired with:<form onSubmit="return myFunction();"> <input type="submit" value="Submit"> </form>
<script language="JavaScript"><!-- function myFunction() { //do stuff if (condition) return true; return false; } //--></script>