index.html 6.5 KB

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