prevent form submit when function called code example Example: javascript prevent form submit <form name="foo" onsubmit="return false">