HTML SELECT <select> Tag
0 2143
HTML SELECT <select> tag is define to create a drop-down list with multiple options. The <option> tag is nested within <select> tag for defining options in a list. The first option from the options list is selected by default. To change the predefined option selected attribute is used.
The <optgroup> tag can be used for grouping related options in a list. The content of <optgroup> looks like heading in bold.
The content is written between opening (<select>) and closing (</select>) tags. A closing tag is mandatory.
Syntax:
<select> content goes here.. </select>
Program:
<!DOCTYPE html> <html> <head> <title>HTML Select Tag</title> </head> <body> <h2>Example of Select Tag</h2> <form> <label>Choose your Favourite city in India</label> <select> <option>New Delhi</option> <option>Gurugram</option> <option>Mumbai</option> <option>Bengaluru</option> <option>Lucknow</option> <option>Amritsar</option> <option>Pune</option> <option>Jaipur</option> <option>Nagpur</option> <option>Patna</option> <option>Chandigarh</option> </select> </form> </body> </html>
Output:
Share:
Comments
Waiting for your comments