Thursday, October 5, 2023
 Popular · Latest · Hot · Upcoming
58
rated 0 times [  65] [ 7]  / answers: 1 / hits: 34043  / 15 Years ago, thu, june 11, 2009, 12:00:00

I'm writing an iPhone web app, and I want to automatically focus a text field when the page is loaded, bringing up the keyboard. The usual Javascript:



input.focus();


doesn't seem to be working. Any ideas?


More From » iphone

 Answers
188

Note: this answer is old and may not be relevant to newer versions out there...



It comes as no help to you but the last poster in this thread wrote that its a bug of the webkit engine.

I can't tell if its a verified bug or not...



Last post from way back machine (as original seems to not work):




I am developing my app in pure XHTML MP / Ecmascript MP / WCSS. So
using native platform browser control api is really not an option for
me. Yes the behaviour u mention is the same as mine. I searched his
topic in the bugzilla at webkit.org and found that this indeed is a
reported bug. focus() to a text box does highlight the element but
does not provide a carat in it for the user to start entering text.
Using a timer as mentioned by [email protected] does not help either.



This behaviour is common across platforms (s60,iphone,android) which
use the webkit engine.



So as of now i dont see a solution to this problem.



Hope this helps



[#99341] Saturday, June 6, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jamilab

Total Points: 687
Total Questions: 88
Total Answers: 86

Location: Antigua and Barbuda
Member since Sat, Apr 24, 2021
3 Years ago
;