how to avoid submit button in html code example Example: prevent button from submitting form function myFunc(e){ e.preventDefault(); }