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

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -