returning false not stopping the submission of form

后端 未结 3 759
星月不相逢
星月不相逢 2020-12-02 22:42

My purpose: If the user field and password field are blank, I want to stop form submitting. This is my Code that I am trying:




        
3条回答
  •  孤城傲影
    2020-12-02 23:40

    onsubmit event accepts boolean values, since you are not returning anything so it assumes true by default. You need to add return in this event explicitly like mentioned below:

    change

    onsubmit="doit()"> 
    

    to

    onsubmit="return doit()"> 
    

提交回复
热议问题