当前位置:网站首页>Use js to listen for Keydown event
Use js to listen for Keydown event
2022-06-12 22:27:00 【withkai44】
1、 Monitor global keyboard press events , For example, monitoring global carriage return Events
$(document).keydown(function(event){
if(event.keyCode == 13){
alert(' You pressed Enter');
}
});
2、 Listen for a component keyboard press event , For example, monitor id by btn Of button Enter press event of component
$("#btn").keydown(function(event){
if(event.keyCode==13){
alert(' You pressed Enter');
}
});
3、 If you want to listen for key combinations , For example, monitor ctrl+c
$(document).keyup(function(event){
if(event.ctrlKey && event.keyCode==67){
alert(' You pressed CTRL+C')
}
});
detailed keyCode List of values 



边栏推荐
- How to specify your webpage's language so Google Chrome doesn't offer to translate it
- NoSQL - redis configuration and optimization (II) high availability, persistence and performance management
- Es6+ new content
- 项目里面的traceID的设计
- JVM Basics - > What are the thread shared areas in the JVM
- Is it safe to open an account with new bonds? How should novices operate?
- JS fighting on...
- Is it safe to open an account in flush? How to open an account online to buy stocks
- Generate the chrysanthemum code of the applet (generate the chrysanthemum code, change the middle logo, change the image size, and add text)
- LNMP platform docking redis service
猜你喜欢

Preliminary use of jvisualvm

Ansible playbook and variable (II)

C # reading table data in word

How to prevent phishing emails? S/mime certificate to help!

Redis optimization

Pat grade A - 1167 Cartesian tree (30 points) (buildtree + level traversal)

JVM foundation > CMS garbage collector

QT quick 3D learning: mouse picking up objects

JVM foundation > G1 garbage collector

Audio and video technology development weekly 𞓜 234
随机推荐
JVM foundation - > what is STW?
2022-02-28 incluxdb high availability planning
Producer consumer model under multithreading model
flutter系列之:flutter中常用的GridView layout详解
Es6+ new content
Mysql concat_ WS, concat function use
The shutter library recommends sizer to help you easily create a responsive UI
Research Report on water sports shoes industry - market status analysis and development prospect forecast
Hostvars in ansible
JVM foundation - > three ⾊ mark
孙老师版本JDBC(2022年6月12日21:34:25)
JVM foundation > CMS garbage collector
Step by step evolution of restful API version Frankel
【LeetCode】数组中第K大的元素
The annual salary of 500000 is one line, and the annual salary of 1million is another line
SQL query list all views in SQL Server 2005 database - SQL query to list all views in an SQL Server 2005 database
[probability theory and mathematical statistics] final review: formula summary and simple examples (end)
China barcode decoder market trend report, technical innovation and market forecast
Is it safe to open an account in tonghuashun? How to open an account for securities
【LeetCode】53.最大子数组和