This is a simple fix. Just change your code to this:
$(document).ready(function() {
$("#tags").select2({
placeholder: "Select tag",
allowClear: true,
minimumInputLength: 2,
maximumSelectionSize: 1,
width: '100%',
});
});
You can also customize your own CSS by adding the following attribute:
containerCssClass: 'mySpecialClass'
CSS .
.mySpecialClass {
width: 100%;
}
!