Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycode value is return as 229 for all keys

I have run the normal textbox in android device an i have face some issues which is mentioned below.

1.Keypress event does not triggered in android device 2.keycode value always return as 229 only

How to resolve this issue?

like image 699
Roy thomas Avatar asked Aug 19 '16 09:08

Roy thomas


People also ask

What is e keyCode === 13?

key 13 keycode is for ENTER key.

What is the keyCode?

A key code is a series of alphanumeric characters used by locksmiths to create a key.

What is keyCode and charCode?

e.keyCode - used to get the number that represents the key on the keyboard. e.charCode - a number that represents the unicode character of the key on keyboard.


1 Answers

Normal keypress event does not give keyCode in android device. There has already been a big discussion on this.

If you want to capture the press of space bar or special chars, you can use keyup event.

$('#input').on('keyup', e => {
     var keyCode = e.keyCode || e.which;
     if (keyCode == 0 || keyCode == 229) { 
         keyCode = e.target.value.charAt(e.target.selectionStart - 1).charCodeAt();             
     }
})
like image 141
Zhming Avatar answered Oct 02 '22 07:10

Zhming