how to prevent form from being submitted in javascript code example Example: javascript prevent form submit <form name="foo" onsubmit="return false">