index.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. <i class="fa fa-arrow-down fa-lg"></i>
  15. Download
  16. </a>
  17. </p>
  18. <p class="version">
  19. <strong>Version</strong> 4.0.0<em>-rc.2</em>
  20. </p>
  21. </div>
  22. </main>
  23. <section class="notice-previous">
  24. <div class="container text-center">
  25. <a href="http://select2.github.io/select2/">Looking for the Select2 3.5.2 docs?</a>
  26. We have moved them to a new location
  27. <a href="announcements-4.0.html">while we push forward with Select2 4.0</a>.
  28. </div>
  29. </section>
  30. <div class="container">
  31. <section id="lead" class="lead">
  32. Select2 gives you a customizable select box with support for searching,
  33. tagging, remote data sets, infinite scrolling, and many other highly used
  34. options.
  35. </section>
  36. <section id="getting-started">
  37. <h2>
  38. Getting started with Select2
  39. </h2>
  40. <p>
  41. In order to use Select2, you must include the JavaScript and CSS file on
  42. your website. You can get these files built for you from many different
  43. locations.
  44. </p>
  45. <h3>
  46. Using Select2 from a CDN
  47. </h3>
  48. <p>
  49. Select2 is hosted on both the
  50. <a href="https://cdnjs.com/libraries/select2">cdnjs</a> and
  51. <a href="http://www.jsdelivr.com/#!select2">jsDelivr</a> CDNs, allowing
  52. you to quickly include Select2 on your website.
  53. </p>
  54. <ol>
  55. <li>
  56. <p>
  57. Include the following lines of code in the <code>&lt;head&gt;</code>
  58. section of your HTML.
  59. </p>
  60. <pre class="code prettyprint">
  61. &lt;link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" /&gt;
  62. &lt;script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/js/select2.min.js"&gt;&lt;/script&gt;
  63. </pre>
  64. <div class="alert alert-info">
  65. <i class="fa fa-info-circle"></i>
  66. Immediately following a new release, it takes some time for CDNs to
  67. catch up and get the new versions live on the CDN.
  68. </div>
  69. </li>
  70. <li>
  71. <p>
  72. Initialize Select2 on the <code>&lt;select&gt;</code> element that you
  73. want to make awesome.
  74. </p>
  75. <pre class="code prettyprint">
  76. &lt;script type="text/javascript"&gt;
  77. $('select').select2();
  78. &lt;/script&gt;
  79. </pre>
  80. </li>
  81. <li>
  82. Check out the <a href="examples.html">examples page</a> to start using
  83. the additional features of Select2.
  84. </li>
  85. </ol>
  86. <h3>
  87. Downloading the code locally
  88. </h3>
  89. <p>
  90. In some situations, you can't use Select2 from a CDN and you must include
  91. the files through your own static file servers.
  92. </p>
  93. <ol>
  94. <li>
  95. <p>
  96. <a href="https://github.com/select2/select2/tags">
  97. Download the code
  98. </a>
  99. from GitHub and copy the <code>dist</code> directory to your project.
  100. </p>
  101. </li>
  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="path/to/select2.min.css" rel="stylesheet" /&gt;
  109. &lt;script src="path/to/select2.min.js"&gt;&lt;/script&gt;
  110. </pre>
  111. </li>
  112. <li>
  113. Check out the <a href="examples.html">examples page</a> to start using
  114. the additional features of Select2.
  115. </li>
  116. </ol>
  117. </section>
  118. <section id="builds">
  119. <h2>
  120. The different Select2 builds
  121. </h2>
  122. <p>
  123. Select2 provides multiple builds that are tailored to different
  124. environments where it is going to be used. If you think you need to use
  125. Select2 in a nonstandard environment, like when you are using AMD, you
  126. should read over the list below.
  127. </p>
  128. <table class="table table-bordered table-striped">
  129. <thead>
  130. <tr>
  131. <th>Build name</th>
  132. <th>When you should use it</th>
  133. </tr>
  134. </thead>
  135. <tbody>
  136. <tr id="builds-standard">
  137. <td>
  138. Standard (<code>select2.js</code> / <code>select2.min.js</code>)
  139. </td>
  140. <td>
  141. This is the build that most people should be using for Select2. It
  142. includes the most commonly used features.
  143. </td>
  144. </tr>
  145. <tr id="builds-full">
  146. <td>
  147. Full (<code>select2.full.js</code> / <code>select2.full.min.js</code>)
  148. </td>
  149. <td>
  150. You should only use this build if you need the additional features
  151. from Select2, like the
  152. <a href="options.html#compatibility">compatibility modules</a> or
  153. recommended includes like
  154. <a href="https://github.com/jquery/jquery-mousewheel">jquery.mousewheel</a>
  155. </td>
  156. </tr>
  157. </tbody>
  158. </table>
  159. </section>
  160. </div>