1

In a recent search to find an AJAX enabled, typeahead, rich HTML based select box alternative, I ran across the JQuery based Select2 (http://ivaynberg.github.com/select2/), and have found it to be a great alternative.

One thing I didn't find extremely well done however, was the documentation about the option to type values into the text box of the select2 plugin that do not appear in the select list.

I have read this post: Entering values into a jquery-select2 that are not in the select list but it doesn´t help me.

Any help or information about it will be really apreciate it.

1 Answer 1

0

try adding this to your $opts initialization:

    //Allow manually entered text in drop down.
    createSearchChoice: function(term, data) {
        if ( $(data).filter( function() {
            return this.text.localeCompare(term) === 0;
        }).length === 0) {
            return {id:term, text:term};
        }
    },

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.