- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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.
Example
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>
- Related Articles
- How do we use a simple drop-down list of items in HTML forms?
- How to preselect Dropdown Using JavaScript Programmatically?
- How to preselect a list item using JavaScript?
- How to Auto-Update a Dropdown List in Excel?
- How to search for items in a dropdown menu with CSS and JavaScript?
- How to select a value from a static dropdown in Selenium?
- How to select multiple options in a dropdown list with JavaScript?
- How to randomize the items of a list in Python?
- Count number of items in a dictionary value that is a list in Python
- Gecko driver, Selecting value from a dropdown list using Selenium
- How to add items to a list in C#?
- Associating a single value with all list items in Python
- How to create an ordered list with list items numbered with numbers in HTML?
- How to display the selected option in a dropdown list with JavaScript?
- How to remove items from a list in C#?

Advertisements