onLoad Focus input field not working in Apple Safari mobile

I use javascript function below to focus input field or textarea when the web page is loaded. It works well in case of standard Android mobile web browsers. But the solution is not working in Safari mobile web browser.

Do you have any suggestions how to apply focus effect on input field or textarea, when the website is loaded in Safari for smartphones ?

<body onLoad="javascript: document.getElementById("email").focus();">
<input type="text" name="emailaddress" id="email" />
</body>
posted on 22.11.2019 at 18:20
0pnshow more
zeddzedd
share on facebookshare on twitter
2021 AnswerTabsTermsContact us