Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap select dropdown list placeholder

I am trying to make a dropdown list that contains a placeholder. It doesn't seem to support placeholder="stuff" as other forms do. Is there a different way to obtain a placeholder in my dropdown?

like image 524
Jordan.J.D Avatar asked Apr 02 '14 20:04

Jordan.J.D


2 Answers

Yes just "selected disabled" in the option.

<select>
    <option value="" selected disabled>Please select</option>
    <option value="">A</option>
    <option value="">B</option>
    <option value="">C</option>
</select>

Link to fiddle

You can also view the answer at

https://stackoverflow.com/a/5859221/1225125

like image 124
Brakke Avatar answered Sep 28 '22 00:09

Brakke


Use hidden:

<select>
    <option hidden >Display but don't show in list</option>
    <option> text 1 </option>
    <option> text 2 </option>
    <option> text 3 </option>
</select>
like image 24
Jay Lin Avatar answered Sep 27 '22 23:09

Jay Lin