Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | onsubmit Event Attribute

  • Difficulty Level : Easy
  • Last Updated : 03 Aug, 2021

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

  • <form>


Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

<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
  • Internet Explorer
  • Opera
  • Firefox
  • Safari


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!