azr*_*zri 2 javascript jquery jquery-select2 bootstrap-5
我无法单击搜索输入下拉列表。首先,我已经用谷歌搜索过,这是 select2 与 bootstrap3 或 bootstrap4 的常见问题,但是对于 bootstrap 5 来说有点不同(我尝试删除 bootstrap 4 上的 z-index 及其工作),我已经尝试过像 z 这样的解决方案-index $.fn.modal.Constructor.prototype.enforceFocus = function() {};、、、$('#mySelect2').select2({ dropdownParent: $('#myModal') });和一些 css 但仍然无法工作。
也许我错过了一些我不确定的东西,已经过去了 4 天,希望你们能帮助我。
这里 jsFiddle : jsfiddle
小智 9
真的不知道为什么,但 dropdownParent 会修复它。
$('.select2').each(function () {
$(this).select2({
theme: 'bootstrap-5',
dropdownParent: $(this).parent(),
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6432 次 |
| 最近记录: |