Jess McKenzie Jess McKenzie - 6 months ago 36
HTML Question

Bootstrap 3 dropdown select value

I am trying to create a dropdown menu using

select
with a
value
/
options
. How can I do this using Bootstrap?

<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="type" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Please Select
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="type">
<li><a href="#">General User</a></li>
<li><a href="#">Service Provider</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Admin</a></li>
</ul>
</div>

Answer

For form components such as select bootstrap use .form-control, see docs here and see select docs example here

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<select class="form-control">
  <option value="General User">General User</option>
  <option value="Service Provider">Service Provider</option>
  <option value="Admin">Admin</option>
</select>