Publish in HTML Tutorial el 23/05/2025 19:31
The <select> element creates a dropdown list that allows users to select one or multiple options from a list. It's commonly used in forms to collect user input when there are predefined choices available. The <select> element works with <option> elements to define the available choices, and optionally with <optgroup> to group related options.
Here's the basic structure of a <select> element:
This is how the above code would appear in a browser:
A simple dropdown with a preselected option using the 'selected' attribute.
Using <optgroup> to categorize options for better user experience.
Adding the 'multiple' attribute allows users to select more than one option (usually with Ctrl/Cmd click).
This example shows how to use JavaScript to respond to selection changes.
This example demonstrates how to populate a select element dynamically using JavaScript.
The <style> HTML element contains style information for a document, or part of a document. ...
The <strong> element is used to indicate that its content has strong importance, seriousnes...
The <span> element is an inline container used to mark up a part of a text or document. Unl...
The <source> element is used to specify multiple media resources for media elements like &l...
The <small> element is used to represent side-comments and small print, typically for discl...
HTML <section> Element: The Complete Guide The <section> element is a semantic HTML ...