HTML | DOM Input Submit Object

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

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:
Before click on the button:

After click on the button:

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

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


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


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.