stop default submit of form in JS code example Example: javascript prevent form submit <form name="foo" onsubmit="return false">