tokenizer.html 884 B

123456789101112131415161718192021222324252627282930313233343536
  1. <section>
  2. <h1 id="tokenizer">Automatic tokenization</h1>
  3. <p>
  4. Select2 supports ability to add choices automatically as the user is
  5. typing into the search field. Try typing in the search field below and
  6. entering a space or a comma.
  7. </p>
  8. <p>
  9. The separators that should be used when tokenizing can be specified
  10. using the <a href="options.html#tokenSeparators">tokenSeparators</a>
  11. options.
  12. </p>
  13. <div class="s2-example">
  14. <p>
  15. <select class="js-example-tokenizer form-control" multiple="multiple">
  16. <option>red</option>
  17. <option>blue</option>
  18. <option>green</option>
  19. </select>
  20. </p>
  21. </div>
  22. <pre data-fill-from=".js-code-tokenizer"></pre>
  23. <script type="text/x-example-code" class="js-code-tokenizer">
  24. $(".js-example-tokenizer").select2({
  25. tags: true,
  26. tokenSeparators: [',', ' ']
  27. })
  28. </script>
  29. </section>