Skip to content
Related Articles

Related Articles

HTML DOM Input tel name Property

View Discussion
Improve Article
Save Article
  • Last Updated : 26 Apr, 2022

The DOM input tel name property in HTML DOM is used to set or return the value of the name attribute of an input tel field. The name attribute is required for each input field. If the name attribute is not specified in an input field then the data of that field would not be sent at all.

Syntax:

  • It returns the Input tel name property. 
telObject.name
  • It is used to set the Input tel name property. 
telObject.name = name

Property Values: It contains a single value name that defines the name of the tel field.

Return Value: It returns a string value that represents the name of the tel field.

Example: This example illustrates how to return the input tel name property.

HTML




<!DOCTYPE html>
<html>
  
<body style="text-align:center;">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h2> DOM Input Tel name property </h2>
      
    <legend>
        Phone Number:
        <input type="tel" id="mytel" name="Phone Number" 
            value="6753682635" required>
    </legend>
    <br><br>
  
    <button onclick="myclick()">
        Click Here!
    </button>
      
    <p id="demo" style="font-size:25px"></p>
  
      
    <script>
        function myclick() {
            var x = document.getElementById("mytel").name;
            document.getElementById("demo").innerHTML = x;
        }
    </script>
</body>
  
</html>

Output: 

 

Supported Browsers:

  • Google Chrome
  • Internet Explorer 10.0 +
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!