Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM Input Submit Object

  • Last Updated : 01 Feb, 2019
Geek Week

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






<!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




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

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




My Personal Notes arrow_drop_up
Recommended Articles
Page :