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