- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to include an option in a drop-down list in HTML?
To include an option in a drop-down list, use the <option> tag in HTML. The HTML <option> tag is used within a form for defining options in the drop-down list.
The HTML <option> tag also supports the following additional attributes −
|Disabled||disabled||Disables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.|
|Label||text||Defines a label to use when using <optgroup>.|
|Selected||selected||Defines the default option to be selected when page loads.|
|Value||text||Specifies the value of the option to be sent to the server|
You can try to run the following code to implement <option> element in HTML −
<!DOCTYPE html> <html> <head> <title>HTML option Tag</title> </head> <body> <form action = "/cgi-bin/dropdown.cgi" method = "post"> <select name = "dropdown"> <option value = "HTML" selected>HTML</option> <option value = "Ruby">Ruby</option> </select> <input type = "submit" value = "Submit" /> </form> </body> </html>
- How to select/get drop down option in Selenium 2?
- How to select a drop-down menu option value with Selenium (Python)?
- How do we use a simple drop-down list of items in HTML forms?
- How to include an acronym in HTML?
- How to include an abbreviation in HTML?
- How to include an embedded object in HTML?
- How to include an input field in HTML?
- How to display all items in the list in the drop down in Selenium?
- How to get all options in a drop-down list by Selenium WebDriver using C#?
- How to get selected text from a drop-down list (select box) using jQuery?
- Create an option group in HTML
- How do we include an anchor in HTML?
- How do we include a section in an HTML document?
- How can I get the selected value of a drop-down list with jQuery?