JQuery Keyboard Event How to Use Method Detailed

jQuery keyboard events are described

jQuery handling keyboard events have three functions, depending on the order of incident,:

jQuery code:
1. Keydown ();

2. Keyup ();

3. KeyPress ();


Keydown ()


The keydown event is triggered when the keyboard is pressed, and can return false to the binding function to prevent the browser’s default event.


Keyup ()


The keyup event is triggered when the button is released, that is, the incident after you press the keyboard.

KeyPress ()


KeyPress events will trigger when tap button, we can understand and raise the same button.


Keyboard events can pass a parameter EVENT, In fact, there is a parameter in the jQuery event function:


jQuery code:


$ (‘INPUT’ ). Keydown (event) {Alert (event.keycode);};
  In the above code, Event.KeyCode can help us get us What is the button? He returned the ASCII code. For example, the upper and lower keys are 38, 40, 37, 39  
If we want to implement Ctrl + Enter is Ctrl + Enter SubmitForm


$ (Document) .KeyPress (Function (E) {if (E.ctrlKey && E.WHICH == 13) $ (“form”)


If you have any questions, please leave a message or to this site community communication discussion, you will progress together, thank you, I hope to help everyone, thank you Everyone supports this site!
                     
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment