I am using this line of code:
document.getElementById("myfield").focus()
in JavaScript, to bring the focus to a given text input field.
On a computer (I am using a Mac) it works fine, but on a mobile (iPhone, iPad) it does not work.
I did the experiment both with Firefox
and Safari
, the result is the same.
Does anyone know why and how to make it work?