Skip to content
Related Articles

Related Articles

HTML | DOM Input Submit Object

Improve Article
Save Article
  • Last Updated : 26 Aug, 2022
Improve Article
Save Article

The Input Submit object in HTML DOM represents the HTML <input> element with type = “submit” attribute. 

Syntax:

  • It creates an Input Submit Object.
document.createElement("INPUT")
  • It is used to access an Input Submit Object.
document.getElementById("id")

Property Values:

  • autofocus: It sets or returns whether a submit button should automatically get focus when the page loads or not.
  • defaultValue: It sets or returns the default value of the submit button.
  • disabled: It sets or returns whether the submit button is disabled or not.
  • form: It returns a reference to the form that contains the submit button.
  • formAction: It sets or returns the value of the formAction attribute of the submit button.
  • formEnctype: It sets or returns the value of the formEnctype attribute of the submit button.
  • formMethod: It sets or returns the value of the formMethod attribute of the submit button.
  • formNoValidate: It sets or returns whether the submit button, allows the form-data to be validated or not.
  • formTarget: It sets or returns the value of the formTarget attribute of the submit button.
  • name: It sets or returns the value of the name attribute of the submit button.
  • type: It returns the form element type of the submit button.
  • value: It sets or returns the value of the value attribute of the submit button.

Return Value: It returns the object, corresponding to the input submit action performed. 

Example 1: This example creates an Input Submit Object 

html




<!DOCTYPE html>
<html>
<head>
    <title>
        HTML DOM Input Submit Object
    </title>
</head>
<body>
    <h2>
        HTML DOM Input Submit Object
    </h2>
    <p>
        Click on the button to create
        submit button
    </p>
    <button onclick = "myGeeks()">
        Click Here!
    </button>
     
    <!-- Script to create submit button -->
    <script>
        function myGeeks() {
            var btn = document.createElement("INPUT");
            btn.setAttribute("type", "submit");
            btn.value = ("Submit @ geeksforgeeks");
            document.body.appendChild(btn);
        }
    </script>
</body>
</html>

Output: 

Before click on the button:

  

After click on the button:

  

Example 2: This example describes the access of an Input Submit Object 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>
        HTML DOM Input Submit Object
    </title>
</head>
<body>
    <h2>
        HTML DOM Input Submit Object
    </h2>
    <p>
        Click on the button to create
        submit button
    </p>
    <input type = "submit" id = "Geeks"
            value = "Submit @ geeksforgeeks">
    <button onclick = "myGeeks()">
        Click Here!
    </button>
    <p id = "GFG"></p>
     
    <!-- Script to create submit button -->
    <script>
        function myGeeks() {
            var btn = document.getElementById("Geeks").value;
            document.getElementById("GFG").innerHTML = btn;
        }
    </script>
</body>
</html>

Output: 

Before click on the button:

  

After click on the button:

  

Supported Browsers: The browser supported by DOM Input Submit Object are listed below:

  • Google Chrome 1 and above
  • Firefox 1 and above
  • Edge 12 and above
  • Opera
  • Safari 1 and above

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!