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 −


<!DOCTYPE html>
      <title>HTML selected attribute</title>
      <p>Here's the list of subjects. Select any one:</p>
         <select name = "dropdown">
            <option value = "Computer Architecture" selected>Computer Architecture</option>
            <option value = "Java">Java</option>
            <option value = "Discrete Mathematics">Discrete Mathematics</option>