index.html 6.5 KB

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