Table Maker3schools TranslateImage CompressorFavicon Icon GeneratorCrop & Resize Image
Apu
Apu June 03, 2023 . #Element . #HowTo

How to set the default value for an HTML select element

If you are looking for how can I set the value for an HTML <select> element, then after reading this article, you can easily do that.

We have a select element with some options. By default, the first option is set as a default value. But, the default value of the select element can be set by using the selected attribute.

The selected attribute is a boolean attribute.
set default value for select element
   <select>
     <option>option 1</option>
     <option>option 2</option>
     <option selected>option 3</option>
     <option>option 4</option>
   </select>
  
Try it Yourself »
save
listen
AI Answer
Write Your Answer
loading
back
View All