捕获“完成”使用Javascript按钮点击iphone的虚拟键盘 [英] Capture "done" button click in iphone's virtual keyboard with Javascript

查看:125
本文介绍了捕获“完成”使用Javascript按钮点击iphone的虚拟键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法使用JavaScript捕获iPhone的虚拟键盘的完成按钮事件?

I'm wondering if there's a way to capture the iPhone's virtual keyboard's done button event, using JavaScript?

基本上,我只想打电话给当用户点击完成时,JS功能。

Basically, I just want to be able to call a JS function when the user clicks done.

推荐答案

完成键与回车键相同。所以你可以听一个按键事件。我正在使用jQuery编写这个,我在咖啡脚本中使用它,所以我试图将它转换回我脑中的js。对不起,如果有错误。

The done key is the same as the enter key. So you can listen to a keypress event. I'm writing this using jQuery and i use it in coffee script so I'm trying to convert it back to js in my head. Sorry if there is an error.

$('someElem').bind("keypress", function(e){
   // enter key code is 13
   if(e.which === 13){
     console.log("user pressed done");
    } 
})

这篇关于捕获“完成”使用Javascript按钮点击iphone的虚拟键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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