2

I am working on a website where the first action of the user is entering text.

I can focus() the <input> element, but the keyboard doesn't show up in Chrome (86) on Android (11). I found answers mentionning click() but it doesn't change anything.

My code is below.

Thank you very much for your help.

<html>

<head>
</head>

<body>
<input/>
<script>
window.onload = e => {
  let input = document.querySelector("input");
  input.focus();
  input.click();
};
</script>
</body>

</html>

Note however that if I have the following div, it works when I click on it: <div onclick='document.querySelector("input").focus()'/>

Does it mean that the keyboard cannot be shown outside a user driven event?

  • Does this answer your question? [How to focus an input field on Android browser through javascript or jquery](https://stackoverflow.com/questions/8858094/how-to-focus-an-input-field-on-android-browser-through-javascript-or-jquery) – Magiczne Oct 24 '20 at 08:34
  • Sadly, no, this is where I got the focus/click idea; and I cannot use jQuery. Since that thread is 8 year old, I tried asking again. Thanks all the same! –  Oct 24 '20 at 09:27

0 Answers0