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" />
give a positive ratinggive a negative rating
22 Nov 2019 at 06:20 PM
Share on FacebookShare on TwitterShare on LinkedInSend email
2024 AnswerTabsTermsContact us