An Introduction to HTML Select

In our ongoing series of lessons on the components of HTML, we will focus on HTML select in this article. The HTML <select> element is used to define a selection list within a form. The selection list is displayed as a drop-down menu from which the user can select one or more options, depending on its attributes.

What is an HTML Select Tag?

The HTML <select> tag is used to create a dropdown list. It is also used in forms to collect user input. 

The <option> tag is used to display available options in a dropdown menu.

html-select-tag

This will produce the following result:

output-html-select.

Full Stack Java Developer Course

The Gateway to Master Web DevelopmentExplore Course
Full Stack Java Developer Course

An Example of Using the HTML <select> Tag With the <optgroup> tag

optgroup-tag

This will produce the following result:

output-optgroup-tag.

Attributes

The HTML <select> tag supports the following attributes:

Attribute

Value

Description

autofocus

autofocus

Specifies that the list should be focused after the page loads

disabled

disabled

Specifies that the drop-down list should be disabled

form

form_id

Specifies one or more form

size

number

Specifies the number of visible options in a drop-down list

required

required

Specifies that the user must select the value before submitting the form.

multiple

multiple

Specifies that multiple values can be selected at a time

name

name

Defines the name for the drop-down menu.

Get skilled in HTML5 and CSS3 with the Full Stack Java Developer Master's Program. Click to check out the program details!

Conclusion

In this article, we briefly introduced HTML select tags. We demonstrated how the select tag can be used inside a form, as well as explained some of its attributes.  Whether you’re looking to break into the exciting industry of web development, or you’re a novice looking to advance your career, earning your certification is the best way to take the next step. Simplilearn’s Full Stack Java Developer program is a great way to expand your skillset and covers everything from back-end Java web developer technologies to MongoDB. Students learn everything from the basics to advanced techniques, and they also have the chance to test their new skills through hands-on exercises and projects.

If you have any questions, please feel free to ask them in our comments section, and our experts will answer them promptly.

About the Author

Aryan GuptaAryan Gupta

Aryan is a tech enthusiast who likes to stay updated about trending technologies of today. He is passionate about all things technology, a keen researcher, and writes to inspire. Aside from technology, he is an active football player and a keen enthusiast of the game.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.