VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-onsubmit-event/

⇱ HTML DOM onsubmit Event - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM onsubmit Event

Last Updated : 12 Jul, 2025

The onsubmit event in HTML DOM occurs after the submission of a form. The form tag supports this event.

Syntax: 

  • In HTML: 
<element onsubmit="Script">
  • In JavaScript: 
object.onsubmit = function(){myScript};
  • In JavaScript, using the addEventListener() method:  
object.addEventListener("submit", myScript);

Example: In this example, we will see the onsubmit event using Javascript. 

Output: 

👁 Image
 


Example: In this example, we will see the onsubmit event using the addEventListener() method in Javascript.

Output: 

👁 Image
 

We have a complete list of HTML DOM methods, to check those please go through this HTML DOM Object Complete reference article.

Supported HTML Tags:  HTML <form> tag

Supported Browsers: The browsers supported by HTML DOM onsubmit Event are listed below: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript.

Comment
Article Tags: