prograhammer prograhammer - 1 year ago 52
jQuery Question

Strange behavior in dropdown search, when using jquery plugin Chosen for dropdowns

Consider my fiddle here:

I'm using the popular jquery plugin Chosen.

I have a

dropdown that looks like this:

<option>Store North - New York, NY</option>
<option>Store South - San Antonio, TX</option>
<option>Store South #2 - San Antonio, TX</option>
<option>Store East - Miami, FL</option>

When I click the dropdown and search for "store south", the 2 results correctly show. However, when I search for "san antonio", I get no results? It seems any search string that contains a space and appears after a dash doesn't work.

Any ideas what's going on?

Answer Source

You just need to add search_contains: true:

    search_contains: true

You can read more on the docs here.

Updated Fiddle

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download