Open In App

HTML DOM Input Tel defaultValue Property

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

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:  

  • It returns the defaultValue property.
telObject.defaultValue
  • It is used to set the defaultValue property.
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.  

HTML




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

tel-defaultValue

Supported Browsers:

  • Chrome 3
  • Edge 12
  • Firefox
  • Opera 11
  • Safari 4


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

Similar Reads