如何使用jQuery捕获退格键? [英] How to trap the backspace key using jQuery?

查看:273
本文介绍了如何使用jQuery捕获退格键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当按下Backspace键时,不会触发jQuery的keyup,keydown或keypress方法.我将如何捕获按下退格键的时间?

It does not appear the jQuery keyup, keydown, or keypress methods are fired when the backspace key is pressed. How would I trap the pressing of the backspace key?

推荐答案

尝试以下方法:

 $('html').keyup(function(e){if(e.keyCode == 8)alert('backspace trapped')})  

这篇关于如何使用jQuery捕获退格键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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