gpt4 book ai didi

bootstrap-5 - 如何在 bootstrap 版本 5 中导入 bootstrap-select?

转载 作者:行者123 更新时间:2023-12-05 08:21:59 25 4
gpt4 key购买 nike

我想用 `bootstrap-select 创建一个简单的选择选项。我正在使用 bootstrap-select 创建我的选择器。

我在控制台看到这个错误

error

<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.rtl.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">
<title>مدیریت</title>
<style>
* {
font-family: Tahoma;
}
</style>
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="lang">زبان</label>
<select id="lang" name="lang" class="form-control">
<option value="1">فارسی</option>
<option value="2">عربی</option>
<option value="3">انگلیسی</option>
</select>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/i18n/defaults-*.min.js"></script>
<script>
$('#lang').selectpicker();
</script>
</body>
</html>

我怎样才能做到这一点?

最佳答案

此插件已更新支持 Bootstrap 5+我使用 Bootstrap 5.1.3 非正式地(非常基本)测试了这个,它似乎在初步测试中找到了

  • 现在 v1.14.0-beta2 (2021-03-25) 支持 Bootstrap 5 +

使用 beta 的 bootstrap 5.2 示例

    * {
font-family: Tahoma, sans-serif;
}
<!DOCTYPE html>
<html lang="fa" dir="rtl">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.14.0-beta3/dist/css/bootstrap-select.min.css">
<title>Languages</title>
</head>

<body>
<div class="container mt-5">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="lang">Language</label>
<select id="lang" name="lang" class="form-control">
<option value="1">English</option>
<option value="2">French</option>
<option value="3">Kiswahili</option>
<option value="3">Diné bizaad</option>
<option value="3">Oneida</option>
</select>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.14.0-beta3/dist/js/bootstrap-select.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.14.0-beta3/dist/js/i18n/defaults-*.min.js"></script>
<script>
$('#lang').selectpicker();
</script>
</body>

</html>

关于bootstrap-5 - 如何在 bootstrap 版本 5 中导入 bootstrap-select?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67643806/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com