在ipad html5网站键盘自动对焦 [英] autofocus with keyboard in an ipad html5 site

查看:135
本文介绍了在ipad html5网站键盘自动对焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个html5应用程序,该应用程序将以kiosk模式用于iPad上。用户必须做的第一件事是登录,所以当主页加载时,我想让屏幕键盘在第一个字段中弹出焦点。



I'已经尝试过所有我能想到的变体,包括


  • html5<输入自动对焦>属性

  • 在窗口onload中调用document.getElementById(nameFirst)。focus()
  • ,但onload会调用一个定时器方法稍后调用焦点调用



有没有人想过如何让键盘自动出现?

解决方案

Mobile Safari不允许用户触摸文本输入元素时显示键盘。我认为这是设计。



http://www.quora.com/Mobile-Safari-iPhone-or-iPad-with-Javascript-how-can-I-launch-the屏幕键盘


I'm working on an html5 app that will be used on iPads in a kiosk mode. The first thing users must do is sign in, so when the homepage loads, I'd like the onscreen keyboard to popup with the focus in the first field.

I've tried all the variants I can think of, including

  • html5 <input autofocus> attribute
  • calling document.getElementById("nameFirst").focus() in window onload
  • same as the previous, but the onload calls a timer method to invoke the focus call later

Has anyone figured out how to make the keyboard automatically appear?

解决方案

Mobile Safari doesn't allow keyboard showing up without user touching text input element. I think it's by design.

http://www.quora.com/Mobile-Safari-iPhone-or-iPad-with-Javascript-how-can-I-launch-the-on-screen-keyboard

这篇关于在ipad html5网站键盘自动对焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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