简体   繁体   English

模拟触控jQuery Mobile

[英]Simulate touch jquery mobile

I want to know how to simulate the touch of a tablet / smartphone device. 我想知道如何模拟平板电脑/智能手机设备的触摸。 The transaction is expected to click automatically when the page is a div with the inclusion in number input, so as to immediately open the numeric keypad on the device for the insertion of values. 当页面是包含数字输入的div时,预计交易会自动单击,以便立即打开设备上的数字小键盘以插入值。 Pc runs on the function: PC在函数上运行:

 $(document).ready(function(){ $('#id_campo_input').trigger('click'); }); 

But on mobile devices does not open the keypad .. If I apply the function to a normal div href with the click works well ... 但是在移动设备上不能打开键盘..如果我将功能应用于普通的div href并单击,效果很好...

You don't need to click, you need to set autofocus on that field(implies that keyboard will be opened). 您不需要单击,您需要在该字段上设置自动对焦(这意味着将打开键盘)。

Read this for more details: http://www.w3schools.com/tags/att_input_autofocus.asp 请阅读以获取更多详细信息: http : //www.w3schools.com/tags/att_input_autofocus.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM