Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
923 views
in Technique[技术] by (71.8m points)

javascript - backSpace not firing the keyup event in android mobile

This is the first time,I am working on mobile Apps.keyUp event not firing If I press backspace button.

I made a jsFiddle for reference.

Initially user entered 23 and then user deleted 3 using backspace button.While entering 23 event firing but while delete time event not firing.

I am using device : motorola motog,Android Version:4.4.2.

How can I fix this,can anyone help me with an example code.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem is somewhere Chrome stopped firing keypress events for "backspace" since Android 4.4. This has been problematic in many webview based apps to catch required events. There is a small relief from this by using the input event that fires whenever user types something, pastes something, or taps on ".com" button in the keyboard, etc.

It is best to rely on input event if you are looking only to capture changes to the input. It is not useful if you want to do preventing default actions.

For your case, I think it should fit. But beware, of the support for this event for earlier than Android 4 version.

Updated fiddle - http://jsfiddle.net/aravindbaskaran/33Snz/24/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...