Dalton Pereira Dalton Pereira - 4 months ago 7
HTML Question

placeholder for select tag

Is it possible to have a placeholder on a select tag?

<select placeholder="select your beverage">

<option>Tea</option>

<option>coffee</option>

<option>soda</option>

</select>


or may be a possible work around?

Answer

EDIT: This did/does work at the time I wrote it, but as Blexen pointed out, it's not in the spec.

Add an option like so:

<option default>Select Your Beverage</option>

The correct way:

<option selected="selected">Select Your Beverage</option>