Open In App

HTML DOM Input Tel value Property

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

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:

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

HTML




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

tel-value

Supported Browsers:

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


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

Similar Reads