tokenizer.html 805 B

1234567891011121314151617181920212223242526272829303132
  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. {% highlight js linenos %}
  23. $(".js-example-tokenizer").select2({
  24. tags: true,
  25. tokenSeparators: [',', ' ']
  26. })
  27. {% endhighlight %}
  28. </section>