Skip to content Skip to sidebar Skip to footer

How To Prevent Bubbling For Form Submit

I have form that calls the function GenerateWords when it is submitted and returns false.
This is causing pro

Solution 1:

Try this in javascript:

 function GenerateWords(F,ev) {  // event object 
    ...
    if(someCondition)  // condition when the form should not be submitted.
    ev.preventDefault();
    }

and you may remove return false; from the form tag and pass the event reference

<form id="3Form" onsubmit="GenerateWords(this,event);">

Post a Comment for "How To Prevent Bubbling For Form Submit"