Alex. b
Alex. b

Reputation: 689

SelectizeJS: Custom tags not shown

I'm trying use Selectize to let users choose tags from a list of tags but also be able to add new tags.

Here is the code:

$("#input").selectize({
  delimiter: ',',
  persist: true,
  options: [{text: 'A', value: 'A'}, {text: 'B', value: 'B'}],
  create: function(input) {
    return { value: input, text: input }
  }
});

If I select A, B and a new tag C they all get saved in the database as A,B,C, but when the page loads again only A and B are shown even if the original textarea contains also C.

It's like Selectize only recognizes the items in options only and ignored any other tag.

Upvotes: 0

Views: 35

Answers (0)

Related Questions