I can not find a solution to this problem.
I have a simple input field like this.
<div class="search"> <input type="text" value="yu no work"/> </div>â
And I'm trying to focus() inside a function. So inside a random function (no matter what function it is) I have this line ...
$('.search').find('input').focus();
This works great on any desktop.
However, it does not work on my iPhone. The field does not focus and the keyboard does not appear on my iPhone.
For testing purposes and to show you guys, I made a quick example:
$('#some-test-element').click(function() { $('.search').find('input').focus(); // works well on my iPhone - Keyboard slides in }); setTimeout(function() { //alert('test'); //works $('.search').find('input').focus(); // doesn't work on my iPhone - works on Desktop }, 5000);â
Any idea why focus() won't work with the timeout function on my iPhone.
To see a live example, check this script on your iPhone. http://jsfiddle.net/Hc4sT/
Update:
I created the same case as in my current project.
I have a select-box that should - when "change" - set focus to the input field and insert kexboard on iphone or other mobile devices. I found out that focus () is set correctly, but the keyboard is not displayed. I need a keyboard to display.
I downloaded the test files right here http://cl.ly/1d210x1W3Y3W ... If you check this on the iphone, you will see that the keyboard is not slide-in.
javascript jquery input iphone focus
matt Aug 30 '12 at 20:00 2012-08-30 20:00
source share