Open In App

HTML DOM Input Tel defaultValue Property

The Input Tel defaultValue property in HTML DOM is used to set or return the default value of the input tel field. This property is used to reflect the HTML value attribute.

The main difference between the default value and value is that the default value indicates the default value and the value contains the current value after making some changes. This property is useful to find out whether the Input Tel field has been changed or not.



Syntax:  

telObject.defaultValue
telObject.defaultValue = value

Property Values: It contains a single property value that defines the default value for the input tel field.



Return Value: It returns a numeric value that represents the default value of the tel field.

Example: This example illustrates how to return the Input input tel defaultValue Property.  




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

Output:

Supported Browsers:


Article Tags :