bootstrap-select

Bootstrap-select is a jQuery plugin that utilizes Bootstrap's dropdown.js to style and bring additional functionality to standard select elements.

Github星跟踪图

Demo

You can view a live demo and some examples of how to use the various options here.

Quick start

Bootstrap-select requires jQuery v1.9.1+, Bootstrap’s dropdown.js component, and Bootstrap's CSS. If you're not already using Bootstrap in your project, a precompiled version of the Bootstrap v3.4.1 minimum requirements can be downloaded here. If using bootstrap-select with Bootstrap v4+, you'll also need Popper.js. For all of Bootstrap v4's requirements, see Getting started. A precompiled version of the requirements will be made available in an upcoming release of bootstrap-select.

Several quick start options are available:

  • Download the latest release.
  • Clone the repo: git clone https://github.com/snapappointments/bootstrap-select.git
  • Install with npm: npm install bootstrap-select
  • Install with yarn: yarn add bootstrap-select
  • Install with Composer: composer require snapappointments/bootstrap-select
  • Install with NuGet: Install-Package bootstrap-select
  • Install with Bower: bower install bootstrap-select
  • Install via CDN (cdnjs or jsDelivr):
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.12/dist/css/bootstrap-select.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.12/dist/js/bootstrap-select.min.js"></script>

<!-- (Optional) Latest compiled and minified JavaScript translation files -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.12/dist/js/i18n/defaults-*.min.js"></script>

The CDN is updated after the release is made public, which means that there is a delay between the publishing of a release and its availability on the CDN.

Usage

Bootstrap 4 only works with bootstrap-select v1.13.0+. By default, bootstrap-select automatically detects the version of Bootstrap being used. However, there are some instances where the version detection won't work. See the documentation for more information.

Via selectpicker class

Add the selectpicker class to your select elements to auto-initialize bootstrap-select.

<select class="selectpicker">
  <option>Mustard</option>
  <option>Ketchup</option>
  <option>Barbecue</option>
</select>

Via JavaScript

// To style only selects with the my-select class
$('.my-select').selectpicker();

or

// To style all selects
$('select').selectpicker();

If calling bootstrap-select via JavaScript, you will need to wrap your code in a .ready() block or place it at the bottom of the page (after the last instance of bootstrap-select).

$(function () {
	$('select').selectpicker();
});

Check out the documentation for further information.

Bugs and feature requests

Anyone and everyone is welcome to contribute. Please take a moment to
review the guidelines for contributing
. Make sure you're using the latest version of bootstrap-select before submitting an issue.

Documentation

Bootstrap-select's documentation, included in this repo in the root directory, is built with MkDocs and hosted at https://developer.snapappointments.com/bootstrap-select. The documentation may also be run locally.

Copyright (C) 2012-2018 SnapAppointments, LLC

Licensed under the MIT license.

主要指标

概览
名称与所有者snapappointments/bootstrap-select
主编程语言JavaScript
编程语言JavaScript (语言数: 5)
平台
许可证MIT License
所有者活动
创建于2012-09-26 20:56:59
推送于2024-07-29 12:26:57
最后一次提交
发布数76
最新版本名称v1.14.0-beta3 (发布于 )
第一版名称1.0.0 (发布于 )
用户参与
星数9.9k
关注者数333
派生数2.7k
提交数1.9k
已启用问题?
问题数2245
打开的问题数296
拉请求数296
打开的拉请求数20
关闭的拉请求数285
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?