jquery airport plugin : How can I make it work with special characters?

橙三吉。 提交于 2019-12-11 14:53:21

问题


I'm using the cool jquery airport plugin and trying to make it accept special characters (like accents, "&", etc.). By default it only works with a-z.

Has anybody found how to do that ?


回答1:


There is a chars array that you can add characters to.

var chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', ' ', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '-'];

Doing this should be enough.

PS: Sometimes, looking at the source code of a program can be really enlightening. ;-)




回答2:


You have to set up the chars array correctly.

var chars = ['a', ..., 'z', ' ', '-', '&', 'ä', 'ö', 'ü'];

Please check this fiddle http://jsfiddle.net/F6Sq4/

The examples uses some german umlauts (äöü), but you might include any other char.



来源:https://stackoverflow.com/questions/3389057/jquery-airport-plugin-how-can-i-make-it-work-with-special-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!