Home > OS >  Why the "select" tag has no "placeholder" attribute?
Why the "select" tag has no "placeholder" attribute?

Time:09-27

All the ways to show the default value in the select tag propose to use a dumb option tag. Why there is no default way just to show a placeholder?

CodePudding user response:

<select name="plan" id="plan">
  <option selected disable hidden>Choose plan</option>
  <option>Free</option>
  <option>Premium</option>
  <option>silver</option>
  <option>gold</option>
</select>

Now your problem is solved

CodePudding user response:

<select required>
  <option value="" disabled selected hidden>Select...</option>
  <option value="1">Option 1</option>
  <option value="2">Option 2</option>
</select>
  •  Tags:  
  • html
  • Related