Open In App

HTML DOM Input Submit value Property

Last Updated : 02 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The Input Submit value Property in HTML DOM is used to set or return the value of the Input Submit Field. The value attribute specifies the text displayed in the Submit Field. 

Syntax: 

  • It returns the value property.
submitObject.value
  • It is used to set the value property.
submitObject.value = text

Property Value: It contains single value text which defines the text displayed in the submit button. 

Return Value: It returns the string value which represent the text displayed in the submit button. 

Example 1: This example illustrates how to return the Input Submit value Property. 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Input Submit value Property
    </title>
</head>
 
<body style="text-align:center;">
    <h1>GeeksforGeeks</h1>
 
    <h2>
        HTML DOM Input Submit value Property
    </h2>
     
    <input type="submit" id="GFG"
        value="Submit GFG"><br><br>
     
    <button onclick="myGeeks()">
        Click Here
    </button>
 
    <p id="result"></p>
 
    <!-- Script to return submit value Property -->
    <script>
        function myGeeks() {
            let submitVal =
                document.getElementById("GFG").value;
 
            document.getElementById("result")
                .innerHTML = "Submit Button Value: "
                + submitVal;
        }
    </script>
</body>
 
</html>


Output: 

submit-value

Example 2: This example illustrates how to set the Input submit value Property. 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Input Submit value Property
    </title>
</head>
 
<body style="text-align:center;">
    <h1>GeeksforGeeks</h1>
 
    <h2>
        HTML DOM Input Submit value Property
    </h2>
     
    <input type="submit" id="GFG"
        value="Submit GFG"><br><br>
     
    <button onclick="myGeeks()">
        Click Here
    </button>
 
    <p id="result"></p>
 
    <!-- Script to set submit value Property -->
    <script>
        function myGeeks() {
            let submitVal = document.getElementById("GFG")
                .value = "Submit@Geeks";
 
            document.getElementById("result")
                .innerHTML = submitVal;
        }
    </script>
</body>
 
</html>


Output: 

submit-value-2

Supported Browsers:

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


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads