index.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. ---
  2. layout: home
  3. title: Select2 - The jQuery replacement for select boxes
  4. slug: home
  5. ---
  6. <main class="jumbotron" role="main">
  7. <div class="container text-center">
  8. <h1>Select2</h1>
  9. <p class="lead">
  10. The jQuery replacement for select boxes
  11. </p>
  12. <p>
  13. <a href="https://github.com/select2/select2/releases" class="btn btn-outline-inverse btn-lg">
  14. Download Select2
  15. </a>
  16. </p>
  17. <p class="version">
  18. Currently v4.0.3</a>
  19. </p>
  20. </div>
  21. </main>
  22. {% include notice-previous.html %}
  23. <div class="container">
  24. <section id="lead" class="lead">
  25. Select2 gives you a customizable select box with support for searching,
  26. tagging, remote data sets, infinite scrolling, and many other highly used
  27. options.
  28. </section>
  29. <hr class="half-rule">
  30. <div class="s2-docs-featurette">
  31. <div class="row">
  32. <div class="col-sm-4">
  33. <i class="fa fa-language"></i>
  34. <h4>In your language</h4>
  35. <p>
  36. Select2 comes with support for
  37. <a href="examples.html#rtl">RTL environments</a>,
  38. <a href="examples.html#diacritics">searching with diacritics</a> and
  39. <a href="examples.html#language">over 40 languages</a> built-in.
  40. </p>
  41. </div>
  42. <div class="col-sm-4">
  43. <i class="fa fa-database"></i>
  44. <h4>Remote data support</h4>
  45. <p>
  46. <a href="examples.html#data-ajax">Using AJAX</a> you can efficiently
  47. search large lists of items.
  48. </p>
  49. </div>
  50. <div class="col-sm-4">
  51. <i class="fa fa-paint-brush"></i>
  52. <h4>Fits in with your theme</h4>
  53. <p>
  54. Fully skinnable, CSS built with Sass and an
  55. <a href="https://github.com/select2/select2-bootstrap-theme">optional theme for Bootstrap 3</a>.
  56. </p>
  57. </div>
  58. </div>
  59. <div class="row">
  60. <div class="col-sm-4">
  61. <i class="fa fa-plug"></i>
  62. <h4>Fully extensible</h4>
  63. <p>
  64. The <a href="announcements-4.0.html#plugin-system">plugin system</a>
  65. allows you to easily customize Select2 to work exactly how you want it
  66. to.
  67. </p>
  68. </div>
  69. <div class="col-sm-4">
  70. <i class="fa fa-tag"></i>
  71. <h4>Dynamic item creation</h4>
  72. <p>
  73. Allow users to type in a new option and
  74. <a href="examples.html#tags">add it on the fly</a>.
  75. </p>
  76. </div>
  77. <div class="col-sm-4">
  78. <i class="fa fa-html5"></i>
  79. <h4>Full browser support</h4>
  80. <p>Support for both modern and legacy browsers is built-in, even including Internet Explorer 8.</p>
  81. </div>
  82. </div>
  83. </div>
  84. <hr class="half-rule">
  85. <section id="getting-started">
  86. <h2>
  87. Getting started with Select2
  88. </h2>
  89. <p>
  90. In order to use Select2, you must include the JavaScript and CSS file on
  91. your website. You can get these files built for you from many different
  92. locations.
  93. </p>
  94. <h3>
  95. Using Select2 from a CDN
  96. </h3>
  97. <p>
  98. Select2 is hosted on both the
  99. <a href="https://cdnjs.com/libraries/select2">cdnjs</a> and
  100. <a href="https://www.jsdelivr.com/#!select2">jsDelivr</a> CDNs, allowing
  101. you to quickly include Select2 on your website.
  102. </p>
  103. <ol>
  104. <li>
  105. <p>
  106. Include the following lines of code in the <code>&lt;head&gt;</code>
  107. section of your HTML.
  108. </p>
  109. {% highlight html %}
  110. <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
  111. <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
  112. {% endhighlight %}
  113. <div class="alert alert-info">
  114. <i class="fa fa-info-circle"></i>
  115. Immediately following a new release, it takes some time for CDNs to
  116. catch up and get the new versions live on the CDN.
  117. </div>
  118. </li>
  119. <li>
  120. <p>
  121. Initialize Select2 on the <code>&lt;select&gt;</code> element that you
  122. want to make awesome.
  123. </p>
  124. {% highlight html %}
  125. <script type="text/javascript">
  126. $('select').select2();
  127. </script>
  128. {% endhighlight %}
  129. </li>
  130. <li>
  131. Check out the <a href="examples.html">examples page</a> to start using
  132. the additional features of Select2.
  133. </li>
  134. </ol>
  135. <h3>
  136. Downloading the code locally
  137. </h3>
  138. <p>
  139. In some situations, you can't use Select2 from a CDN and you must include
  140. the files through your own static file servers.
  141. </p>
  142. <ol>
  143. <li>
  144. <p>
  145. <a href="https://github.com/select2/select2/tags">
  146. Download the code
  147. </a>
  148. from GitHub and copy the <code>dist</code> directory to your project.
  149. </p>
  150. </li>
  151. <li>
  152. <p>
  153. Include the following lines of code in the <code>&lt;head&gt;</code>
  154. section of your HTML.
  155. </p>
  156. {% highlight html %}
  157. <link href="path/to/select2.min.css" rel="stylesheet" />
  158. <script src="path/to/select2.min.js"></script>
  159. {% endhighlight %}
  160. </li>
  161. <li>
  162. Check out the <a href="examples.html">examples page</a> to start using
  163. the additional features of Select2.
  164. </li>
  165. </ol>
  166. </section>
  167. <section id="builds">
  168. <h2>
  169. The different Select2 builds
  170. </h2>
  171. <p>
  172. Select2 provides multiple builds that are tailored to different
  173. environments where it is going to be used. If you think you need to use
  174. Select2 in a nonstandard environment, like when you are using AMD, you
  175. should read over the list below.
  176. </p>
  177. <table class="table table-bordered table-striped">
  178. <thead>
  179. <tr>
  180. <th>Build name</th>
  181. <th>When you should use it</th>
  182. </tr>
  183. </thead>
  184. <tbody>
  185. <tr id="builds-standard">
  186. <td>
  187. Standard (<code>select2.js</code> / <code>select2.min.js</code>)
  188. </td>
  189. <td>
  190. This is the build that most people should be using for Select2. It
  191. includes the most commonly used features.
  192. </td>
  193. </tr>
  194. <tr id="builds-full">
  195. <td>
  196. Full (<code>select2.full.js</code> / <code>select2.full.min.js</code>)
  197. </td>
  198. <td>
  199. You should only use this build if you need the additional features
  200. from Select2, like the
  201. <a href="options.html#compatibility">compatibility modules</a> or
  202. recommended includes like
  203. <a href="https://github.com/jquery/jquery-mousewheel">jquery.mousewheel</a>
  204. </td>
  205. </tr>
  206. </tbody>
  207. </table>
  208. </section>
  209. </div>