- 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 preselect a value in a dropdown list of items in HTML forms?
With HTML, you can easily create a simple drop down list of items to get user input in HTML forms. A select box also called drop down box provides an option to list down various options in the form of drop down list.
You can also preselect a value in dropdown list of items in HTML forms. For that, add selected in the <option> tag for the value you want to preselect.
You can try to run the following code to learn how to preselect value in a dropdown list of items works in HTML form −
<!DOCTYPE html> <html> <head> <title>Select Box Control</title> </head> <body> <p> Select any one:</p> <form> <select name = "dropdown"> <option value = "Java" selected>Java</option> <option value = "Discrete Mathematics">Discrete Mathematics</option> </select> </form> </body> </html>
- How do we use a simple drop-down list of items in HTML forms?
- How to select a value from a static dropdown in Selenium?
- Gecko driver, Selecting value from a dropdown list using Selenium
- Count number of items in a dictionary value that is a list in Python
- How to randomize the items of a list in Python?
- Associating a single value with all list items in Python
- How to add items to a list in C#?
- How to count the number of items in a C# list?
- How to remove items from a list in C#?