I'm doing form validation using jquery validate plugin. It works great, however if DOM is not fully loaded and you click submit button then the document ignores validation and goes to a page specified in form "action" attribute. Is it possible to prevent submit button from submitting until DOM is loaded?
If you generate your submit button like so:
<input type="submit" id="submit" value="submit" disabled="disabled"/>
Then you can put this in your $(document).ready(
right after the validation plugin has been initialised:
$("#submit").prop("disabled", false);
Demo: http://jsfiddle.net/nZVrs/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With