Search code examples
jquery-select2jquery-select2-4

Select2 set tokenSeparators using data attribute


I'm trying to set tokenSeparators option using data-token-separators="[',']" but nothing happens, what is the right syntax to pass array of token separators in data attribute?


Solution

  • data-token-separators="[',']" is the correct way to do it. You may want to update to a newer version of Select2 as I found earlier versions were not handling this feature very well.