All, I am trying to disable the resizing of the dropdown button and hide the overflow of text.
My current application has a bootstrap dropdown with some rather large options available for selection. I would like to..
- Keep the selection button at a specific width.
- hide any over flow that happens when the user selects a text option large in size.
I can set the width of the button itself, but whenever I select a selection that has a large length, the text overflows outside of the button.
HTML
<div class="btn-group dropdown">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Select Values <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="#">Some Very Large Value</a></li>
<li><a href="#">Some Very Large Value Some Very Large Value</a></li>
<li><a href="#">Some Very Large Value Some Very Large Value Some Very Large Value</a></li>
</ul>
</div>
JavaScript
$(document).ready(function () {
//Makes the selected value show at the top of the dropdown box
$(".dropdown-menu li a").click(function () {
$(this).parents(".dropdown").find('.btn').html($(this).text() + ' <span class="caret"></span>');
$(this).parents(".dropdown").find('.btn').val($(this).data('value'));
});
});
Thanks!