Example of Canceling the Submit Behavior of a Form

This page has a form with a submit button. Type something and click submit

Clicking the submit button will not submit the form. The <form> tag has an "onsubmit" attribute with some Javascript to run when a user submits the form.

		<form 
			action="http://nytimes.com" 
			method="POST"
			onsubmit="return false;">
That Javascript merely says "return false;", which overrides the default submit behavior of the form, and prevents the form from submitting. If we didn't have that onsubmit attribute, and it didn't say "return false;", then the form would have submitted as usual.