Home > Web Front-end > JS Tutorial > body text

Summary of event object attributes and methods in jquery_jquery

WBOY
Release: 2016-05-16 17:08:33
Original
1299 people have browsed it

JQuery Reading Notes – Event Property Description
The Event property in JQuery events is often ignored. It's true that most of the time you don't use it that much, but sometimes it still works. For example, know the user's environment when triggered (whether shift etc. were pressed). Each browser has different views on events. Jquery has standardized Events so you can use them with confidence.

* .target This reacts to the DOM object that triggers the event. You can determine whether it is the source of the event when the event bubbles up (compare event.target to this)
* .pageX: The left attribute of the mouse, relative to page
* .pageY: The top attribute of the mouse, relative to page
* preventDefault(): When this method is called, the original event will be ignored. (For example, the clicked link will not go to the new Url)
* stopPropagation(): Let Jquery stop event bubbling
* .Data: If there is EventData in the event, you can use this attribute to get the corresponding Eventdata data .
* ctrlKey: Type: Boolean, Description: Whether the Ctrl key is pressed
* shiftKey: Type: Boolean, Description: Whether the Shift key is pressed
* altKey: Type: Boolean, Description: Whether the Alt key is pressed Next
* charCode: Type: Number, description: The charCode value of the last response to the keyboard key
* keyCode: Type: Number, description: The keyCode value of the last response to the keyboard key
* button: Type: Number, description : Pressed mouse button, left button: 1, right button: 2, middle button: 4
* which: Type: Number, Description: Which button was last responded to, if it is a keyboard button, it is equal to charCode || keyCode; If it is a mouse button, left button: 1, right button: 3, middle button 2

type: event type
relatedTarget: for mouse events, indicates the DOM element leaving or entering when the event is triggered
currentTarget: the DOM object of the current triggering event before bubbling, equivalent to this.
result : The value returned by the previous event handler function
screenX/Y: For mouse events, get the horizontal/vertical coordinates of the event relative to the screen origin

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template