How to add createSearchChoice to select2 widget

Hello,

How to inline createSearchChoice function to select2 widget, for instance this one:

createSearchChoice:function(term, data) { if ($(data).filter(function() { return this.text.localeCompare(term)===0; }).length===0) {return {id:term, text:term};} },

Best regards

0 votes

0 answers

1971 views

ANSWER