templateResult + tags true

Hi guys,
I’m new at Select2 and have a situation.
I need to allow users to set values that are NOT in the select item, I made it with “tags:true”
Later I wanted to add some CSS based on a condition and I used the “templateResult” function and works fine.
The problem is the select doesn’t allow new values now.

How can I fix this?

Thank you

The templateResult callback is used to style the items in the dropdown (or “results”) list. You probably need to implement the templateSelection callback, which styles the item(s) the user has selected (including new items the user has created).

If that doesn’t resolve your problem, can you post your code on Codepen.io or jsfiddle.net so I can see what’s happening?

I fixed with “templateSelection”
Thank you !

Great news! I’m glad it worked for you.