Reputation: 663
When there are no options, the select box shrinks to too narrow width & even "No results found" appears distorted.
Refer fiddle
$('#example').select2({
placeholder: 'Select a month'
});
<select id="example" multiple="multiple"></select>
Any solutions?
Upvotes: 1
Views: 656
Reputation: 10922
Make use of the width
option of select2 as follow :
$('#example').select2({
placeholder: 'Select a month',
width: "100%"
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.js"></script>
<select id="example" multiple="multiple"></select>
Upvotes: 6