【问题标题】:Select2 weird dropdown positioningSelect2 奇怪的下拉定位
【发布时间】:2021-11-04 11:00:27
【问题描述】:

我正在尝试将 Select2 功能添加到我的下拉列表中,但是,Select2 列表的位置完全搞砸了。见下文

代码:

js文件:

$(document).ready(function() {
    $(".js-Selector").select2({
        
        });
    });

html 文件:

<label for="input-time">Select local timezone: </label>

<p>
    <select class="js-Selector"></select>
</p>

可能是什么问题?

【问题讨论】:

  • $(".js-Selector").select2() ???什么是 select2?

标签: javascript html jquery-select2


【解决方案1】:

似乎缺少安装 Select2 下拉菜单的样式。确保您已关注installation steps 并包含指向样式表的链接。

<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />

【讨论】:

    猜你喜欢
    • 2023-04-09
    • 1970-01-01
    • 2013-02-23
    • 2020-07-05
    • 2011-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多