index.html 6.1 KB

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