
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How to specify that an option should be pre-selected when the page loads in HTML?
Use the selected attribute to specify that the option should be pre-selected when page loads in HTML. You can try to run the following code to implement selected attribute −
Example
<!DOCTYPE html> <html> <head> <title>HTML selected attribute</title> </head> <body> <p>Here's the list of subjects. Select any one:</p> <form> <select name = "dropdown"> <option value = "Computer Architecture" selected>Computer Architecture</option> <option value = "Java">Java</option> <option value = "Discrete Mathematics">Discrete Mathematics</option> </select> </form> </body> </html>
- Related Articles
- How to specify that an element should be pre-selected when the page loads in HTML?
- How to specify that the element should automatically get focus when the page loads in HTML?
- How to specify if and how the author thinks the audio/video should be loaded when the page loads in HTML?
- How to specify that the form should not be validated when disabled in HTML?
- How to specify that the details should be visible to the user in HTML?
- How to specify whether the content of an element should be translated or not in HTML?
- When should a Call Option be exercised?
- When should a Put Option be exercised?
- How to specify that the target will be downloaded when a user clicks on the hyperlink in HTML?
- How to specify the URL of the page the link goes to in HTML?
- How to specify whether the form-data should be encoded while submitting to the server with HTML?
- How to specify the HTML content of the page to show in the <iframe> in HTML?
- How to specify that an element is not yet relevant in HTML?
- How to specify that the element must be filled out before submitting the form in HTML?
- How to specify the number of columns an element should be divided into with CSS

Advertisements