Stop form submission with submit eventlistener

前端 未结 3 830
清酒与你
清酒与你 2020-12-17 04:26

I\'m trying to stop a form from submitting using the submit eventlistener. My anonymous function runs but the form still submits, even with return false at the end of the fu

3条回答
  •  一整个雨季
    2020-12-17 05:15

    I always call event.preventDefault() on event listeners that I want to cancel the event for, as well as return false. This always works for me.

    
    

提交回复
热议问题