Bootstrap Tutorial - Create dropdown with envelope icon








The following code shows how to create dropdown with envelope icon.

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.2.2/js/bootstrap.min.js"></script>
<script type='text/javascript'>
$(window).load(function(){<!--from  w  w  w . j  a  va2s  . c  o m-->
    $('.dropdown-toggle').dropdown();
    $('#divNewNotifications li > a').click(function(){
        $('#text').text($(this).html());
    });
});
</script>
</head>
<body>
  <ul class="nav nav-pills left">
    <li class="dropdown active span8"><a class="dropdown-toggle"
      id="inp_impact" data-toggle="dropdown"> 
      <i class="icon icon-envelope icon-white"></i> 
      <span id="text">Select</span>
      <span class="caret"></span></a>
      <ul ID="divNewNotifications" class="dropdown-menu">
        <li><a>One</a></li>
        <li><a>Two</a></li>
        <li><a>Three</a></li>
      </ul>
    </li>
  </ul>
</body>
</html>

Click to view the demo