javascript - How to prevent form submiting before DOM is ready? -
I am using javascript to validate the form,
but then restrain the case Can not do when the form is submitted before the DOM is ready
I tried:
But the form can still be submitted.
Before submitting a dome, check before posting to stop a post.
& lt; Form method = "POST" onsubmit = "return handle ()" & gt; & Lt; Input type = "submit" / & gt; & Lt; / Form & gt; & Lt; Script & gt; Function handles () {return IMDR; } Var imReady = false; Function set read () {imReady = true; } // Edit: Add this line window.onDomReady = setReady (); & Lt; / Script & gt;
Comments
Post a Comment