Open In App

HTML DOM Input Tel value Property

The Input Tel value Property in HTML DOM is used to set or return the value of Tel attribute in the input Tel field. The value attribute specifies the initial value of the input Tel field. It contains the default value or the user types.

Syntax:



telObject.value
telObject.value = number

Property Value: It contains a single value number that defines the value of the input tel field.

Return Value: It returns the numeric value which represents the value of the tel field.



Example: This example illustrates how to change the Input Tel value Property.




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Input Tel value Property
    </title>
</head>
 
<body style="text-align:center;">
    <h1>GeeksforGeeks</h1>
 
    <h2>HTML DOM Input Tel value Property</h2>
 
 
    <label for="mytel">Phone Number:</label>
    <input type="tel" id="mytel"
        value="6753682635" autofocus><br><br>
 
    <button onclick="myGeeks()">
        Click Here
    </button>
 
    <p id="result"></p>
 
    <script>
        function myGeeks() {
            let x = document.getElementById("mytel")
                .value = "99773474883";
 
            document.getElementById("result").innerHTML
                = "The value of phone number cahanged to" + x;
        }
    </script>
</body>
 
</html>

Output:

Supported Browsers:


Article Tags :