index.html 4.7 KB

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