Select2选择框无法显示求助(Bootstrap5+JQuery环境)
Select2 4.1.0rc 结合Bootstrap 5.1.3显示异常问题
我在使用Select2最新RC版本(4.1.0rc)时遇到选择框无法正常显示的问题,当前环境为Bootstrap 5.1.3、jQuery 3.6.1。
我已经尝试过切换稳定版与RC版本、使用默认主题、排查自定义主题是否存在样式覆盖,但都没能解决问题。
JavaScript代码
const locationSelect = $('#location').select2({ ajax: { delay: 250, url: "<?= site_url('admin/select2_get_locations'); ?>", dataType: 'json', type: 'GET', data: function (params) { return { q: params.term }; }, processResults: function (data) { return { results: data.results }; }, }, minimumInputLength: 3, escapeMarkup: function (markup) { return markup; }, });
HTML代码
<div class="col-sm-12 col-md-4 mb-4"> <label for="location">Filtro per località</label> <select id="location" name="location" style="width: 100% !important"> <option value="" selected>Seleziona</option> </select> </div>
显示效果

内容的提问来源于stack exchange,提问作者Developer lci-agency
相关产品推荐
相关产品推荐

