在移动 Safari 中设置文本框焦点 [英] Set textbox focus in mobile safari

查看:26
本文介绍了在移动 Safari 中设置文本框焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我想知道如何在 Mobile Safari 中将焦点设置为文本框.

Hey, I was wondering how to set the focus to a text box in Mobile Safari.

我试过 document.myForm.myTextArea.focus() 它在常规 Safari 中有效,但在 Mobile Safari 中似乎不起作用.

I've tried document.myForm.myTextArea.focus() which works in regular Safari, but it does not seem to work in Mobile Safari.

澄清一下,我想在用户加载页面后立即将焦点设置到文本框,并弹出 iPhone 键盘.

To clarify, I want to set focus to a text box as soon as the user loads a page, and have the iPhone keyboard pop up.

推荐答案

刚刚发现这篇上一篇文章指出这是 webkit 中的一个错误.抱歉没有进行更彻底的搜索.

Just found this previous post stating this is a bug in webkit. Sorry for not doing a more thorough search.

http://discussion.forum.nokia.com/forum/showthread.php?t=127724

这篇关于在移动 Safari 中设置文本框焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆