Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在表单中,我有一个带有数据列表的文本输入。在数据列表中,我添加了不会出现在我的文本输入中的重音术语。例如:如果我输入“a”,带有“ä”或“à”的术语将不会出现在建议中......
最好的办法是对口音不敏感
有没有人遇到过这个问题?
谢谢
您可以这样做的一种肮脏方法是执行以下操作:
var noAccent = str.normalize( "NFD" ).replace( /[\u0300-\u036f]/g, "" ); if (str !== str) {// Add a duplicate entry without the accent}