I have a bootstrap button dropdown with items. I want the dropdown item text, when clicked, to show up in the button text. What is the easiest way to do this?
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Groups <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
</ul>
</div>
I've done so by doing this. But the problem is, when I put the new value into the button it expands the button and looses the caret. How can I make the button stay a certain width and keep the caret?