Js and jquery implement sample code for listening to Keyboard Events, and jquery sample code

Source: Internet
Author: User

Js and jquery implement sample code for listening to Keyboard Events, and jquery sample code

In the project, you must listen to the keyboard and press CTRL + C to respond accordingly. Some methods are checked, but their compatibility and stability are not very high. The following method is obtained. It can be used in Firfox, Chrome, and IE.
I. implemented using javascript

<! DOCTYPE html> 

Ii. Implement with jquery

<! DOCTYPE html> 

Iii. Description
Event. ctrlKey
Function: checks whether the Ctrl key is held down when an event occurs.
Syntax: event. ctrlKey
Value: true | false 1 | 0
Note:
If the ctrlKey attribute is true, the Ctrl key is pressed and maintained when the event occurs. If the value is false, the Ctrl key is not pressed.
The ctrlKey attribute can be used with the mouse or keyboard to create shortcuts.
Iv. Detailed keyCode Value List

The above is the sample code for listening to Keyboard Events using js and jquery. I hope it will be helpful for your learning.

Articles you may be interested in:
  • Listen to IME keyboard input events in JavaScript
  • Sample Code for js listening to Keyboard Events
  • Implement keyboard button monitoring based on Jquery
  • Jquery. hotkeys listens to the keyboard press event keydown plug-in
  • Js listens to mouse clicks and keyboard click events and automatically jumps to the page
  • Simple calculator Based on HTML + CSS and jQuery (added a keyboard listener)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.