Update dropdown button
Description
The following code shows how to update dropdown button.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.10.1.js'></script>
<link rel="stylesheet" type="text/css"
href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<script type='text/javascript'
src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<style type='text/css'>
.action {<!-- w w w . jav a 2 s . c o m-->
width: 100px;
}
</style>
<script type='text/javascript'>
$(window).load(function(){
jQuery("#action-1").click(function(e){
jQuery('.action').html('one <span class="caret"></span>');
e.preventDefault();
});
jQuery("#action-2").click(function(e){
jQuery('.action').html('two <span class="caret"></span>');
e.preventDefault();
});
jQuery("#action-3").click(function(e){
jQuery('.action').html('three <span class="caret"></span>');
e.preventDefault();
});
});
</script>
</head>
<body>
<div class="btn-group">
<button class="btn dropdown-toggle action" data-toggle="dropdown">
Nav name <span class="caret"></span>
</button>
<ul class="dropdown-menu test">
<li><a href="#" id="action-1">one</a></li>
<li><a href="#" id="action-2">two</a></li>
<li><a href="#" id="action-3">three</a></li>
</ul>
</div>
</body>
</html>