HTML DOM Input Submit form property

The HTML DOM Input Submit form property is used for returning the form reference that contains the given submit button. If the submit button is outside the form then it will simply return NULL. This property is read-only.


Following is the syntax for input submit form property −



Let us look at an example for the Input Submit form property −

<!DOCTYPE html>
<h1>Input submit form Property</h1>
<form action="Sample_page.php" id="FORM_1" style="border:solid 2px green;padding:2px">
UserName: <input type="text" id="USR"> <br>
Location: <input type="text" id=“Loc”> <br><br>
<input type="submit" id="SUBMIT1">
<p>Get the form id by clicking on the below button</p>
<button type="button" onclick="formId()">GET FORM</button>
<p id="Sample"></p>
   function formId() {
      var P=document.getElementById("SUBMIT1");
      document.getElementById("Sample").innerHTML = "The id of the form containing the submit
      button is: "+P ;


This will produce the following output −

On clicking the GET FORM −