博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jquery按键事件_jQuery按键事件
阅读量:2530 次
发布时间:2019-05-11

本文共 1620 字,大约阅读时间需要 5 分钟。

jquery按键事件

jQuery keypress is one of the keyboard event methods. Other jQuery keyboard event methods are keyup and keydown.

jQuery keypress是键盘事件方法之一。 其他jQuery键盘事件方法是keyup和keydown。

jQuery按键 (jQuery keypress)

jQuery keypress method triggers with key press event of the javascript. Since this event varies across browsers, this is not covered in any official specification. This event triggers only for the focused element. This can vary across different browsers.

jQuery keypress方法使用javascript的按键事件触发。 由于此事件在不同的浏览器中会有所不同,因此任何正式规范均未涵盖。 此事件仅针对焦点元素触发。 跨不同的浏览器可能会有所不同。

jQuery keypress方法语法 (jQuery keypress method syntax)

  1. keypress(): This jQuery keypress method is used without any arguments.

    keypress():此jQuery keypress方法使用时不带任何参数。
  2. keypress(handler): This jQuery keypress method attaches a function to be executed when the keypress event is fired.

    keypress(handler):此jQuery keypress方法附加了一个在触发keypress事件时要执行的功能。

jQuery按键示例 (jQuery keypress example)

Following example demonstrates the use of jQuery keypress method.

以下示例演示了jQuery keypress方法的使用。

jquery-keypress.html

jquery-keypress.html

jQuery keypress event example

jQuery keypress example

Enter anything:
Type something above, background colour will change to yellow on key press.
Click on Reset button to try again.

In above example, when the key is pressed, keypress() method is triggered which in turn executes the function that changes the background colour to yellow.

在上面的示例中,当按下键时,将触发keypress()方法,该方法又执行将背景色更改为黄色的功能。

Below screencast shows above jQuery keypress event example in action.

下面的截屏视频显示了上面的jQuery keypress事件示例。

jQuery按键演示 (jQuery keypress demo)

翻译自:

jquery按键事件

转载地址:http://mmlzd.baihongyu.com/

你可能感兴趣的文章
4.1 分解条件式
查看>>
Equivalent Strings
查看>>
flume handler
查看>>
收藏其他博客园主写的代码,学习加自用。先表示感谢!!!
查看>>
H5 表单标签
查看>>
su 与 su - 区别
查看>>
C语言编程-9_4 字符统计
查看>>
在webconfig中写好连接后,在程序中如何调用?
查看>>
限制用户不能删除SharePoint列表中的条目(项目)
查看>>
【Linux网络编程】使用GDB调试程序
查看>>
feign调用spring clound eureka 注册中心服务
查看>>
ZT:Linux上安装JDK,最准确
查看>>
LimeJS指南3
查看>>
关于C++ const成员的一些细节
查看>>
《代码大全》学习摘要(五)软件构建中的设计(下)
查看>>
C#检测驱动是否安装的问题
查看>>
web-4. 装饰页面的图像
查看>>
微信测试账户
查看>>
Android ListView上拉获取下一页
查看>>
算法练习题
查看>>