Accents in HTML5 datalist

In the form, I have text input with a datalist. In the datalist, I emphasized terms that would not appear in my text input. For example: If I type "a", the terms with "ä" or "à" will not appear in the sentence ...

Would be best insensitive to accent

Has anyone encountered this problem already?

thank

+4
source share
1 answer

One dirty way to do this is to do something like this:

var noAccent = str.normalize( "NFD" ).replace( /[\u0300-\u036f]/g, "" );
if (str !== str) {// Add a duplicate entry without the accent}
0
source

Source: https://habr.com/ru/post/1537835/


All Articles