How to use the <datalist> tag in HTML?

HTMLWeb DevelopmentFront End Technology

<p style="">The HTML &lt;datalist&gt; tag specifies a set of options for &lt;input&gt; element. You need to also add an id. Use the &lt;option&gt;&hellip;&lt;option&gt; tag inside the &lt;datalist&hellip;&lt;/datalist&gt; tag.</p><p><img src="/assets/questions/images/136637-1516359865.jpg" style="width: 473px; height: 513.519px;" class="fr-fic fr-dii" width="473" height="513.519"></p><h2>Example</h2><p style="">You can try to run the following code to use the &lt;datalist&gt; tag in HTML &minus;</p><pre class="prettyprint notranslate">&lt;!DOCTYPE html&gt; &lt;html&gt; &nbsp; &nbsp;&lt;head&gt; &nbsp; &nbsp; &nbsp; &lt;title&gt;HTML Datalist Tag&lt;/title&gt; &nbsp; &nbsp;&lt;/head&gt; &nbsp; &nbsp;&lt;body&gt; &nbsp; &nbsp; &nbsp; &lt;p&gt;Type the tool name:&lt;/p&gt; &nbsp; &nbsp; &nbsp; &lt;input list = &quot;tools&quot; /&gt; &nbsp; &nbsp; &nbsp; &lt;datalist id = &quot;tools&quot;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;option value = &quot;Image Editor&quot;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;option value = &quot;Whiteboard&quot;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;option value = &quot;Image Optimizer&quot;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;option value = &quot;Document Viewer&quot;&gt; &nbsp; &nbsp; &nbsp; &lt;/datalist&gt; &nbsp; &nbsp;&lt;/body&gt; &lt;/html&gt;</pre>
raja
Updated on 15-Jun-2020 11:17:09

Advertisements