简体   繁体   中英

js does not recognize accented chars onclick

I have an input element which has an onkeyUp bind. The problem I am facing is that when a user enters accented chars ie: Ä ä Ö ö Ü ü The JS does not fire the onkeyup event/function. on regular chars this works fine. Also, if I enter an accented char and a regular char (Ös) the bind recognizes both charecters and fire the event/function. Also, copy pasting the accented char works great. Any ideas?

I am using a swiss keyboard and you are right : keyup event returns the same value for chars é and ö which are provided from the same key ( ö is activated by shift ).

You can use keypress event to catch all keyboard events including specials keys : http://api.jquery.com/keypress/

Well... I found that accented charecters get to my JS file as keyCode=0, and therefore I ignored them. added a new rule for: (event.keycode==0), Tnx again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM