1

This is my code.

$(".input_text").keydown(function (e) {
   let char = e.key;
   if(char == "A"){
      //my code
   }
});

This code works perfect for computers, but when I test it with my mobile phone it's not working. When I alert char I got 'undefined'. I tried many solutions form net but unfortunately didn't work

vimuth
  • 5,064
  • 33
  • 79
  • 116
  • Did you try e.which? https://stackoverflow.com/questions/47478453/keyup-keydown-and-keypress-events-not-working-on-mobile – Charan Kumar Jul 15 '21 at 19:46
  • Thanks but for my requirement I can't use key codes :'( – vimuth Jul 15 '21 at 19:52
  • More here. Also try the lower case "a" instead of the capital letter. https://stackoverflow.com/questions/302122/jquery-event-keypress-which-key-was-pressed#302161 – Nathaniel Flick Jul 15 '21 at 20:33

0 Answers0