简体   繁体   中英

How do I get the last thing input from an “input” event

I have been trying to deal with getting the last input in to a text field on an Android app from Javascript.

I was originally trying to use the KeyUp, KeyDown and KeyPress events to get the KeyCodes from keyboard input however with android soft keyboards you will get the KeyCode 229 for every key other than backspace, space and enter.

So now I am using the onInput event however this just seems to alert me to the fact that something has been input in to a text field and not what that input was.

document.getElementById("textarea").addEventListener("input", function (e) {
    ClaroSpeak.KeyHandler(e);
}, false);

Does the input event some how let me know what the last change or key was, eg 'space' 'a' 'F' ect...

设置“全局”变量并在其中存储最后一个元素怎么办?

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