Skip to content
Related Articles

Related Articles

HTML DOM Input Text list Property

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

The input Text list property in HTML DOM is used to return a reference to the datalist element that contains an input text field. 


Return Value: It returns a string value that represents the value of the id attribute of the datalist element. 

Example: Below HTML code used to return the input text list property. 


<!DOCTYPE html>
    <title> HTML DOM Input Text list Property</title>
<body style="text-align:center">
    <h1 style="color:green">
    <h2>DOM Input Text list property</h2>
    <label><b>Your Cars Name:</b> </label>
    <input type="text" list="cars" id="text_id" value="">
    <datalist id="cars">
        <option value="BMW" />
        <option value="Bentley" />
        <option value="Mercedes" />
        <option value="Audi" />
        <option value="Volkswagen" />
    <button onclick="btnclick()">Click Here!</button>
    <p id="paraID" style="font-size:20px"></p>
    <!-- script to access text field -->
        function btnclick() {
            var txt = document.getElementById("text_id");
            document.getElementById("paraID").innerHTML = txt;



Supported Browsers:

  • Google Chrome 1
  • Edge 12
  • Mozilla Firefox 1
  • Opera
  • Safari 1

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!