Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
How to get the key from a keydown event on mobile?

I am trying to listen to a keydown and keyup event in a web app and need to retrieve the key. On desktop, this works fine with the following code.

const inputElement = document.querySelector("input");
const keydownList = document.getElementById("keydownList");
const keyupList = document.getElementById("keyupList");

inputElement.addEventListener("keydown", (e) => {
  const li = document.createElement("li");
  li.innerText = e.key;
  keydownList.appendChild(li);
});

inputElement.addEventListener("keyup", (e) => {
  const li = document.createElement("li");
  li.innerText = e.key;
  keyupList.appendChild(li);
});
<h2>Input</h2>
<input type="text">
<h2>Keydown</h2>
<ul id="keydownList"></ul>
<h2>Keyup</h2>
<ul id="keyupList"></ul>

The problem is that on mobile this does not work (at least, I tested on Android). Firefox just outputs "Process" every time instead of the key, and Chrome outputs "Unidentified". The same applies to the corresponding jquery version of the code.

How can one fix this? (I have tried to do some research on this, but was not able to find a solution.)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!