Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML | onsubmit Event Attribute

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 16 Aug, 2022
Improve Article
Save Article

The onsubmit event attribute in HTML is triggered when a form is submitted. 
Supported Tags: 


<form onsubmit = "script">

Attribute Value: This attribute contains single value script which works when onsubmit event call.
Note: This attribute can only be used within form tag. 


<!DOCTYPE html >
        <title>onsubmit event attribute</title>
            body {
            h1 {
            function Geeks() {
                alert("Form submitted successfully.") ;
        </script >
        <h2>onsubmit event attribute</h2>
        <form onsubmit = "Geeks()">
            First Name:<input type = "text" value = "" /><br/>
            Last Name:<input type = "text" value = "" /><br/>
            <input type = "submit" value = "Submit" />



Supported Browser: The browser supported by onsubmit event attribute are listed below: 

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 9
  • Opera 8
  • Firefox 1
  • Safari 3


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!