user103372
user103372

Reputation:

Chosen jQuery plugin search with spaces

I have a problem with the Chosen jQuery plugin. When I try to search for a string which has space in it I get no results even if it does exist.

For example: If I enter the string "and barbu" I don't get anything back. But when I write "antigua and barbu" I get the result.

What should I do to fix this space problem?

Upvotes: 10

Views: 7098

Answers (1)

Pierre Granger
Pierre Granger

Reputation: 2010

Answer here : Changing search behavior in jquery plugin Chosen Just need to add

jQuery('select').chosen({search_contains:true}) ;

As mentionned on the options doc : http://harvesthq.github.io/chosen/options.html

search_contains false By default, Chosen’s search matches starting at the beginning of a word. Setting this option to true allows matches starting from anywhere within a word. This is especially useful for options that include a lot of special characters or phrases in ()s and []s.

Upvotes: 28

Related Questions