Key and Code values for "enter" key in mobile

My project isn't working on mobile devices. On desktop, it works when the user press "enter" or "backspace" keys, but not on mobile. Is there key and code values for the relative "key" and code event for enter and backspace properties on mobile devices? code:
5 Replies
Pi (I'll eat who dont correct me
document.addEventListener("keyup", (e) => {
const enter = "Enter";

if (e.code === enter) {
const inputField = document.querySelectorAll(".js-inputField");
const boxes = document.querySelectorAll(".js-card");
const isRowFilled = checkIfRowIsFilled(inputField, word);

if (isRowFilled) {
inputField.forEach((input) => input.setAttribute("disabled", "true"));

gameCheckers(word, inputField, updateCount);
setTimeout(()=>{
const wordsRight = updateCount(0);

const tries = updateTries(1);

if (wordsRight === word.length) {
createCongratsDiv(word, tries, createInputs, addEventsToInputs, generateGrid, generateRandomWord);
updateCount(-(wordsRight));
updateTries(-tries);
}

if (wordsRight !== word.length) {
createNewRow(boxes, word, tries, createInputs);
addEventsToInputs();

const newInput = document.querySelector(".js-inputField");

if (newInput) {
newInput.focus();
}

}

updateCount(-(wordsRight));
}, 400*(word.length-1))

}

setTimeout(()=> {
const tries = updateTries(0);
console.log("tries: ", tries)

if (tries === 4) {
tryAgain(generateGrid, createInputs, addEventsToInputs, word)
updateTries(-tries);

}
}, 400*(word.length - 1));


}
})
document.addEventListener("keyup", (e) => {
const enter = "Enter";

if (e.code === enter) {
const inputField = document.querySelectorAll(".js-inputField");
const boxes = document.querySelectorAll(".js-card");
const isRowFilled = checkIfRowIsFilled(inputField, word);

if (isRowFilled) {
inputField.forEach((input) => input.setAttribute("disabled", "true"));

gameCheckers(word, inputField, updateCount);
setTimeout(()=>{
const wordsRight = updateCount(0);

const tries = updateTries(1);

if (wordsRight === word.length) {
createCongratsDiv(word, tries, createInputs, addEventsToInputs, generateGrid, generateRandomWord);
updateCount(-(wordsRight));
updateTries(-tries);
}

if (wordsRight !== word.length) {
createNewRow(boxes, word, tries, createInputs);
addEventsToInputs();

const newInput = document.querySelector(".js-inputField");

if (newInput) {
newInput.focus();
}

}

updateCount(-(wordsRight));
}, 400*(word.length-1))

}

setTimeout(()=> {
const tries = updateTries(0);
console.log("tries: ", tries)

if (tries === 4) {
tryAgain(generateGrid, createInputs, addEventsToInputs, word)
updateTries(-tries);

}
}, 400*(word.length - 1));


}
})
` For "enter" I figured it out to use "e.key" instead But the same doesn't work for mobile devices
Pi (I'll eat who dont correct me
I've solved about enter already (and keyCode is deprecated) I'm having trouble with backspace
Want results from more Discord servers?
Add your server
More Posts