submit button event preventdefault code example Example: prevent button from submitting form function myFunc(e){ e.preventDefault(); }