Open In App

HTML DOM Input Submit value Property

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: 



submitObject.value
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. 




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

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




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

Supported Browsers:


Article Tags :