Saswat Saswat - 8 months ago 32
jQuery Question

Search issue on chosen dropdown using jQuery

I am implementing chosen dropdown in my project. But I have some problem which I want to solve.

Before proceeding, let me give you the jQuery fiddle:

Now I have a dropdown like this

<select id="drp_menu">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
<option value="Option 4">Option 4</option>
<option value="Option 5">Option 5</option>

As you can see in the fiddle:

1) If I write
in the searchbox then the list is filtered showing all the options.

2) If I write
" 1"
it shows
"Option 1"

3) If I write
it shows
"Option 1"

4) If I write
then it states
"No results"

5) If I write
then it states
"No result"

I want to results if words typed in the searchbox matches.


add { search_contains: true } and Enjoy :)

JS Code:

   $('#drp_menu').chosen({ search_contains: true });