Bootstrap Tutorial - Create dropdown with caret








The following code shows how to create dropdown with caret.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css">
<script type='text/javascript'
  src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<style type='text/css'>
#idValue {<!--  w w  w. j a  va  2  s  .  co  m-->
  width: 40px;
  height: 20px;
  background-color: #E6E6E6;
}
</style>

</head>
<body style='margin:30px'>
  <br />
  <br />
  <div class="dropdown btn-group">
    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
      Select <span class="caret"></span>
    </a> 
    <ul id="selectId" class="dropdown-menu">
      <li value="10"><a href="#">10</a></li>
      <li value="20"><a href="#">20</a></li>
      <li value="30"><a href="#">30</a></li>
      <li value="40"><a href="#">40</a></li>
      <li value="50"><a href="#">50</a></li>
      <li value="60"><a href="#">60</a></li>
      <li value="70"><a href="#">70</a></li>
    </ul>
  </div>
</body>
</html>

Click to view the demo