davidstutz / bootstrap-multiselect

JQuery multiselect plugin based on Twitter Bootstrap.
https://davidstutz.github.io/bootstrap-multiselect/
Other
3.68k stars 1.98k forks source link

search with accents #1252

Open leandroBarbosaFR opened 1 year ago

leandroBarbosaFR commented 1 year ago

Hello everybody, When I search and don't put accents, my search doesn't work, how do I turn off the accents?

mr-rayhaan commented 6 months ago

I fixed it by editing the bootstrap_multiselect.js file. I use the normalize function to replace the search query and also the select options

Original:

if (this.query !== event.target.value) { this.query = event.target.value;

var currentGroup, currentGroupVisible; $.each($('.multiselect-item', this.$ul), $.proxy(function(index, element) { var value = $('input', element).length > 0 ? $('input', element).val() : ""; var text = $('label', element).text();

Fixed:

if (this.query !== event.target.value) { this.query = event.target.value.normalize('NFD').replace(/[\u0300-\u036f]/g, "");

var currentGroup, currentGroupVisible; $.each($('.multiselect-item', this.$ul), $.proxy(function(index, element) { var value = $('input', element).length > 0 ? $('input', element).val() : ""; var text = $('label', element).text().normalize('NFD').replace(/[\u0300-\u036f]/g, "");