iPhone触发键盘输入字段(HTML / Javascript) [英] iPhone Trigger keyboard in input field (HTML / Javascript)

查看:131
本文介绍了iPhone触发键盘输入字段(HTML / Javascript)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在第一个字段中,您可以在第二个字段中输入3位数
可以在第三个字段中输入3位数
,您可以输入4位数字



当我第一个字段为3位数时,我希望将焦点移动到第二个和第三个移动到第三个。



使用不是那么聪明的javascript它即工作,但是在iPhne有一个问题:当焦点移动在第二个字段中,我设法在eh字段上创建和触发不同的事件,屏幕键盘不想重新出现。



我尝试使用简单的焦点) 方法。
然后创建和调度焦点事件,单击事件touchstart事件,触摸结束事件,但我不会设法了解如何使浏览器显示键盘。



<有没有人有一个想法如何做到这一点?
HELP



Thx



Daniel

解决方案

一个element.focus()应该显示键盘。你一定要做错事。另外,如果所有的输入/文本区域都是一个表单元素,它应该自动前进到下一个元素。您也可以使用element.blur()隐藏键盘。


I am trying to set a few input field connectd to each other.

in the 1st field you can enter 3 digit in the 2nd field you can enter 3 digit in the 3rd field you can enter 4 digits

When i the first field as 3 digits, i would like to have the focus move to the 2nd one and same for the moving to teh 3rd one.

Using not so smart javascript it ie working, however on iPhne there is an issue: whene the focus is moved to the 2nd field, althouth i manage to create and trigger different events on eh field, the on screen keyboard do not want to reappear.

I tried to use simple focus() method. Then to create and dispatch focus event, click event touchstart event, touch end event but i di dnot manage to figure out how to make the browser show the keyboard.

Is there anyone out there with an idea how to do this? HELP

Thx

Daniel

解决方案

An element.focus() should show the keyboard. You must be doing something wrong. Additionally if all your input / text areas are in a form element it should auto advance to the next element. You can also use element.blur() to hide the keyboard.

这篇关于iPhone触发键盘输入字段(HTML / Javascript)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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