从JavaScript手动触发iPhone / iPad / iPod键盘 [英] Manually triggering the iPhone/iPad/iPod keyboard from JavaScript
本文介绍了从JavaScript手动触发iPhone / iPad / iPod键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个使用简单的DIV和捕获事件的HTML代码编辑器。当我在iPad上使用此键盘时,键盘从不弹出,因为我在技术上并不处于可编辑区域。
有没有一种方法可以通过编程的方式告诉iPad我需要一个keybaord?
解决方案如果您的代码是通过用户操作启动的东西执行的,那么它就可以工作。
$
$
< input type ='text'id ='foo'b $ b this works(pops keyboard):
>< div onclick ='$(#foo)。focus();'>点击< / div> 这不起作用(输入获取边框但没有键盘弹出):
< input type ='text'id ='foo'>
< script>
window.onload = function(){
$(#foo)。focus();
}
< / script>
I am developing an HTML code editor using simple DIV's and capturing events. When I use this on the iPad the keyboard never pops up since i'm not technically in an editable field.
Is there a way to programatically tell the iPad that I need a keybaord?
解决方案
If your code is executed via something that was initiated via a user action then it will work.
E.g;
this works (pops keyboard):
<input type='text' id='foo'><div onclick='$("#foo").focus();'>click</div>
this doesn't work (input gets a border but no keyboard pop):
<input type='text' id='foo'>
<script>
window.onload = function() {
$("#foo").focus();
}
</script>
这篇关于从JavaScript手动触发iPhone / iPad / iPod键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文