
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML
The <datalist> tag is used to set pre-defined options for <input> tag. Whenever a user places mouse cursor in the <input>, then all these pre-defined options should be visible.
Let us now see an example to implement the <datalist> tag in HTML −
Example
<!DOCTYPE html> <html> <body> <p>Favorite Subject</p> <form action="" method="get"> <input list="subject" name="subject"> <datalist id="subject"> <option value="Programming"> <option value="Networking"> <option value="Database"> <option value="Big Data"> <option value="Cloud"> <option value="Framework"> </datalist> <input type="submit"> </form> </body> </html>
Output
Now, keep the mouse cursor inside the input box. The following pre-defined options would be visible now −
In the above example, we have set the pre-defined options for <input> −
<datalist id="subject"> <option value="Programming"> <option value="Networking"> <option value="Database"> <option value="Big Data"> <option value="Cloud"> <option value="Framework"> </datalist>
Now, on placing the cursor inside the above <input>, the following options would be visible, which we have pre-defined using the <datalist> element −
Programming Networking Database Big Data Cloud Framework
- Related Articles
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag

Advertisements