index.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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">
  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. Include the following lines of code in the <code>&lt;head&gt;</code>
  57. section of your HTML.
  58. <pre class="code prettyprint">
  59. &lt;link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" /&gt;
  60. &lt;script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/js/select2.min.js"&gt;&lt;/script&gt;
  61. </pre>
  62. <div class="alert alert-info">
  63. <i class="fa fa-info-circle"></i>
  64. Immediately following a new release, it takes some time for CDNs to
  65. catch up and get the new versions live on the CDN.
  66. </div>
  67. </li>
  68. <li>
  69. Initialize Select2 on the <code>&lt;select&gt;</code> element that you
  70. want to make awesome.
  71. <pre class="code prettyprint">
  72. &lt;script type="text/javascript"&gt;
  73. $('select').select2();
  74. &lt;/script&gt;
  75. </pre>
  76. </li>
  77. <li>
  78. Check out the <a href="examples.html">examples page</a> to start using
  79. the additional features of Select2.
  80. </li>
  81. </ol>
  82. <h3>
  83. Downloading the code locally
  84. </h3>
  85. <p>
  86. In some situations, you can't use Select2 from a CDN and you must include
  87. the files through your own static file servers.
  88. </p>
  89. <ol>
  90. <li>
  91. <a href="https://github.com/select2/select2/tags">
  92. Download the code
  93. </a>
  94. from GitHub and copy the <code>dist</code> directory to your project.
  95. </li>
  96. <li>
  97. Include the following lines of code in the <code>&lt;head&gt;</code>
  98. section of your HTML.
  99. <pre class="code prettyprint">
  100. &lt;link href="path/to/select2.min.css" rel="stylesheet" /&gt;
  101. &lt;script src="path/to/select2.min.js"&gt;&lt;/script&gt;
  102. </pre>
  103. </li>
  104. <li>
  105. Check out the <a href="examples.html">examples page</a> to start using
  106. the additional features of Select2.
  107. </li>
  108. </ol>
  109. </section>
  110. <section id="builds">
  111. <h2>
  112. The different Select2 builds
  113. </h2>
  114. <p>
  115. Select2 provides multiple builds that are tailored to different
  116. environments where it is going to be used. If you think you need to use
  117. Select2 in a nonstandard environment, like when you are using AMD, you
  118. should read over the list below.
  119. </p>
  120. <table class="table table-bordered table-striped">
  121. <thead>
  122. <tr>
  123. <th>Build name</th>
  124. <th>When you should use it</th>
  125. </tr>
  126. </thead>
  127. <tbody>
  128. <tr id="builds-standard">
  129. <td>
  130. Standard (<code>select2.js</code> / <code>select2.min.js</code>)
  131. </td>
  132. <td>
  133. This is the build that most people should be using for Select2. It
  134. includes the most commonly used features.
  135. </td>
  136. </tr>
  137. <tr id="builds-full">
  138. <td>
  139. Full (<code>select2.full.js</code> / <code>select2.full.min.js</code>)
  140. </td>
  141. <td>
  142. You should only use this build if you need the additional features
  143. from Select2, like the
  144. <a href="options.html#compatibility">compatibility modules</a> or
  145. recommended includes like
  146. <a href="https://github.com/jquery/jquery-mousewheel">jquery.mousewheel</a>
  147. </td>
  148. </tr>
  149. </tbody>
  150. </table>
  151. </section>
  152. </div>