Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Secondly, you would never put a
event.preventDefault()
inside of the
submitHandler
callback...
it's not even recognized here because there is no default
event
to prevent.
the plugin is already automatically blocking the form's default submit event.
Finally, when using the
submitHandler
to run custom code, don't forget to include the default code for submitting the form as the last line in the function...
submitHandler: function(form) {
// your code here
console.log("Hello...");
form.submit(); // default form submit
Anyway, unless you fix the question by showing a demo, it's all working fine here...
DEMO: jsfiddle.net/e8xkwfzc
If always refresh the page after you click the submit button, when the best way disable submit event on the form.
<form method="post" action="/etc.php" onsubmit="return false;">
<input type="text" value="apple">
<input type="submit" value="Submit">
</form>
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.