Reputation: 506
I want to create a simple select option with `bootstrap-select. I'm using bootstrap-select to create my select picker.
I see this error in the console
<!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/[email protected]/dist/css/bootstrap.rtl.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/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/[email protected]/dist/js/bootstrap.bundle.min.js"
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap-select.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/i18n/defaults-*.min.js"></script>
<script>
$('#lang').selectpicker();
</script>
</body>
</html>
How can I achieve this?
Upvotes: 11
Views: 51015
Reputation: 10529
In December of 2023, this project is officially orphaned for over a year now.
Unfortunately, it seems developments on this project have come to a halt. I tried to impulse a new dynamic but without success to be honest.
Current HEAD stands at v1.14.0-beta3 - But this version caused various troubles for me when upgrading a web application from Bootstrap 3 to 5.
However, a kind soul has provided some more fixes and dubbed this v1.14.0-gamma1.
In my case this solved enough problems to avoid replacing the lib with something else.
Upvotes: 4
Reputation: 34217
This plug-in has been updated to support Bootstrap 5+ I informally (very basic) tested this using Bootstrap 5.1.3 and it seems to work find in that preliminary test
Sample with bootstrap 5.2 using the beta
* {
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/[email protected]/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/[email protected]/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/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap-select.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/i18n/defaults-*.min.js"></script>
<script>
$('#lang').selectpicker();
</script>
</body>
</html>
Upvotes: 18
Reputation: 9
bootstrap-select.js needs to update for compatible to bootstrap@5+
Upvotes: 0
Reputation:
bootstrap-select for Bootstrap 5 is still under development. See https://github.com/snapappointments/bootstrap-select/tree/v1.14-dev for current versions.
Upvotes: 5