How to open iOS keyboard when loading page

I have an html web application and I want the keyboard to open when my page loads, I tried:

<textarea class="form-control" autofocus="autofocus"></textarea> 

but all it does is focus the text area and make it visible when I touch the page, and not just automatically when the page loads.

I heard that this cannot be done without any user interaction in JavaScript only. If true, are there plugins that can do this?

Hope this makes sense, thanks!

+5
source share
1 answer

Unfortunately, autofocus is not supported by mobile Safari due to usability reasons. I saw how people tried various works, including imitation of a click / focus on the considered element. I could never get it to work, although at least on mobile Safari.

 $(function(){ $('#my-textarea').focus().click(); }) 
+5
source

Source: https://habr.com/ru/post/1207491/


All Articles