简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM