Javascript typeahead js重音折叠,不区分重音

Javascript typeahead js重音折叠,不区分重音,javascript,json,jquery-autocomplete,typeahead.js,accent-insensitive,Javascript,Json,Jquery Autocomplete,Typeahead.js,Accent Insensitive,我使用的是typeahead,我遵循了它,但我不能成功,我不知道我的错在哪里 这是我的js var charMap = { "à": "a", "á": "a", "â": "a", "é": "e", "è": "e", "ê": "e", "ë": "e", "É": "e", "ï": "i", "î": "i",

我使用的是typeahead,我遵循了它,但我不能成功,我不知道我的错在哪里

这是我的js

        var charMap = {
        "à": "a",
        "á": "a",
        "â": "a",
        "é": "e",
        "è": "e",
        "ê": "e",
        "ë": "e",
        "É": "e",
        "ï": "i",
        "î": "i",
        "ô": "o",
        "ö": "o",
        "û": "u",
        "ù": "u",
        "ü": "u",
        "ñ": "n"    
    };

    var normalize = function (input) {
        $.each(charMap, function (unnormalizedChar, normalizedChar) {
            var regex = new RegExp(unnormalizedChar, 'gi');
            input = input.replace(regex, normalizedChar);
        });
        return input;
    };

    var queryTokenizer = function (q) {
        var normalized = normalize(q);
        return Bloodhound.tokenizers.whitespace(normalized);
    };

        var tels = new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
            queryTokenizer: queryTokenizer,
            limit: 10,
            prefetch: {
                url: 'assets/tels.json',
                filter: function (name) {
                    return $.map(tels,  function (name) {
                        // Normalize the name - use this for searching
                        var normalized = normalize(name);
                        return {
                            value: normalized,
                            // Include the original name - use this for display purposes
                            displayValue: name
                        };
                    })
                }
                }
        });
    tels.initialize();
 $('#the-basics').typeahead({
                hint: true,
                highlight: true,
                minLength: 2
            },
            {
                name: 'tels',
                displayKey: 'displayValue',
                source: tels.ttAdapter()
            });

非常感谢

您在浏览器控制台中是否遇到任何错误?你能详细介绍一下你遇到的问题吗?谢谢你的回复。在firefox的控制台上没有任何错误或任何东西。我想做的就是做一些像这样的东西。它适用于带有重音的本地单词,但当我尝试使用json时,我做不到。你能在问题中添加一个tels.json的示例吗?然后我可以检查您的$.map设置是否正确。我的json原始样本。你可以输入“兰瑟,米勒,特雷”,我试着用重音折叠