I want to have a dropdown with a set of values but also allow the user to \"select\" a new value not listed there.
I see that select2 supports this if you are using
Just for the sake of keep the code alive, I'm posting @rrauenza Fiddle's code from his comment.
HTML
jQuery
$("#tags").select2({
createSearchChoice:function(term, data) {
if ($(data).filter(function() {
return this.text.localeCompare(term)===0;
}).length===0)
{return {id:term, text:term};}
},
multiple: false,
data: [{id: 0, text: 'story'},{id: 1, text: 'bug'},{id: 2, text: 'task'}]
});