Set Default Value For HTML Select


How to set default value for HTML dropdown select ?

This is your HTML dropdown with four options.

<select>
  <option>Value1</option>
  <option>Value2</option>
  <option>Value3</option>
  <option>Value4</option>
</select>

By default the Value is selected since it’s the first dropdown select option. To set another default value for the HTML select dropdown you can use the selected attribute to the respective select option.

<select>
  <option>Value1</option>
  <option>Value2</option>
  <option selected>Value3</option>
  <option>Value4</option>
</select>

Now since the Value3 has the selected attribute it will be selected by default.