HTML select
You are Here:
HTML select
The HTML <select> tag allows the user to choose one value from a list.
Note: The <option>
tag is used to define an item contained in the <select> tag, <optgroup> tag, or <datalist> tag.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<select>
<option>Morning</option>
<option>Afternoon</option>
<option>Night</option>
</select>
</body>
</html>
HTML Select with Option Group
Use <optgroup> tag to create a group of options within a <select> element.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<select>
<optgroup label="Asian Countries">
<option>India</option>
<option>China</option>
<option>Japan</option>
</optgroup>
<optgroup label="European Countries">
<option>Germany</option>
<option>Italy</option>
<option>France</option>
</optgroup>
</select>
</body>
</html>
Reminder
Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in HTML.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.