Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Form onsubmit Event

Form onsubmit Event

Form Object Reference Form Object


Definition and Usage

The onsubmit event is called when the form is submitted.

Syntax

onsubmit="

JavaScriptCode

"

Parameters Description
JavaScriptCode Required. Specifies the JavaScript code to be executed after the event is triggered.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onsubmit event


Example

Example

Display an alert box after the submit button is clicked to submit the form:

What is your name?

Try it »


Form Object Reference Form Object