basics.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <section>
  2. <h1 id="basics" class="page-header">The basics</h1>
  3. <h2 id="single">Single select boxes</h2>
  4. <p>
  5. Select2 can take a regular select box like this...
  6. </p>
  7. <p>
  8. <select class="js-states form-control"></select>
  9. </p>
  10. <p>
  11. and turn it into this...
  12. </p>
  13. <div class="s2-example">
  14. <p>
  15. <select class="js-example-basic-single js-states form-control"></select>
  16. </p>
  17. </div>
  18. {% highlight html linenos %}
  19. <script type="text/javascript">
  20. $(document).ready(function() {
  21. $(".js-example-basic-single").select2();
  22. });
  23. </script>
  24. <select class="js-example-basic-single">
  25. <option value="AL">Alabama</option>
  26. ...
  27. <option value="WY">Wyoming</option>
  28. </select>
  29. {% endhighlight %}
  30. <h2 id="multiple">Multiple select boxes</h2>
  31. <p>
  32. Select2 also supports multi-value select boxes. The select below is declared with the <code>multiple</code> attribute.
  33. </p>
  34. <div class="s2-example">
  35. <p>
  36. <select class="js-example-basic-multiple js-states form-control" multiple="multiple"></select>
  37. </p>
  38. </div>
  39. {% highlight html linenos %}
  40. <script type="text/javascript">
  41. $(".js-example-basic-multiple").select2();
  42. </script>
  43. <select class="js-example-basic-multiple" multiple="multiple">
  44. <option value="AL">Alabama</option>
  45. ...
  46. <option value="WY">Wyoming</option>
  47. </select>
  48. {% endhighlight %}
  49. </section>
  50. </section>