form onsubmit jquery

http://stackoverflow.com/questions/3384960/want-html-form-submit-to-do-nothing

keywordnya: form no action onsubmit

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

    return false;    
}
//--></script>

Subscribe to receive free email updates:

0 Response to "form onsubmit jquery"

Post a Comment