Bootstrap Tutorial - Combine dropdown button with input group








The following code shows how to combine dropdown button with input group.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-git2.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://getbootstrap.com/assets/css/docs.css">
<link rel="stylesheet" type="text/css"
  href="http://getbootstrap.com/dist/css/bootstrap.css">
<script type='text/javascript'
  src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
</head><!-- ww  w .  j  av a  2 s.co m-->
<body style='margin:30px'>
  <div class="input-group">
    <input type="text" class="form-control " placeholder="username">
    <div class="input-group-btn">
      <button type="button" class="btn btn-default dropdown-toggle"
        data-toggle="dropdown">
        Dropdown <span class="caret"></span>
      </button>
      <ul class="dropdown-menu">
        <li><a href="#">Dropdown link</a></li>
        <li><a href="#">Dropdown link</a></li>
      </ul>
    </div>
  </div>
</body>
</html>

Click to view the demo