I finally got this plugin to work with IE9 in compatibility mode only to realize that its only filtering by 'starts with' ... has anyone implemented or knows how to make this thing work with a 'contains' search instead?
Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.
Chosen now supports this directly as an option:
$(".chzn-select").chosen({ search_contains: true });
From 'pfiller' on the Chosen issues forum:
Chosen doesn't support it by default, but it is a relatively minor change. Just remove the ^
from the following line:
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
Should look like this now:
regex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With