Android returns 229 keycode

Advertisement

So I’m working on a simple landing page that accepts information from the site visitors, one thing that it requires though is the capability to filter inputs, e.g. Name only letters, Phone Number and Age only number and so on.

This works fine in Desktop and in iOS devices, however, I got a bang in Android devices as it only returns 299 keycodes most of the time, why?, Android, why?, so I’ve started digging around I found this handy snippet.

NOTE: You’ll have to add another function that checks the current user navigator.


event.target.value.charAt(event.target.value.length - 1).charCodeAt()

That’s pretty much it, from there you’ll able to grab keycode from mobile.

Advertisement