HTML event-child element event does not trigger parent element event

Source: Internet
Author: User
Tags deprecated

<Divclass= "List-row"onclick= "Showchatdialog (' dy ', ' 100000001 ', true);">     <imgclass= "icon"src= "/icon/default.ico"onclick= "Persondata (event,100000001);">     <aclass= "nickname">Dy</a>    <aclass= "Time">6-2 21:28</a>    <aclass= "MSG">Aa</a> </Div>
function Persondata (ev,id) {    ev.stoppropagation ();    Bodycontainer.children (). Hide ();    $ (". Person-data"). Show ();    $ (". Person-data. Body-body"). HTML ("");    GetObjectData (UserID);}

Funname event will be passed to the function parameter, the call must be event, then the function is not necessarily the name of the event

The same is true for Funname (this), which passes the current DOM element to the function, which must be called when this

Ev.stoppropagation () block event bubbling to parent element

JqueryEvent MethodJQuery Event Method

Event method triggers or adds a function to the event handler of the selected element.

The following table lists all the jQuery methods used to handle events.

Method Description
Bind () Adding an event handler to an element
Blur () Add/trigger loss of focus event
Change () Add/Trigger Change event
Click () Add/Trigger Click event
DblClick () Add/trigger Double click event
Delegate () Add handlers to the current or future child elements of the matching element
Die () Removed in version 1.9. Remove all event handlers added through the Live () method
Error () Deprecated in version 1.8. Add/Trigger Error events
Event.currenttarget The current DOM element within the event bubbling phase
Event.data Contains optional data that is passed to the event method when the currently executing handler is bound
Event.delegatetarget Returns the element added by the currently invoked JQuery event handler
Event.isdefaultprevented () Returns whether the Event.preventdefault () is called on the specified event object
Event.isimmediatepropagationstopped () Returns whether the Event.stopimmediatepropagation () is called on the specified event object
Event.ispropagationstopped () Returns whether the Event.stoppropagation () is called on the specified event object
Event.namespace Returns the namespace specified when an event is triggered
Event.pagex Returns the position of the mouse relative to the left edge of the document
Event.pagey Returns the position of the mouse relative to the top edge of the document
Event.preventdefault () Default behavior for blocking events
Event.relatedtarget Returns which element enters or exits when the mouse is moved
Event.result Contains the last value returned by the event handler that is triggered by the specified event
Event.stopimmediatepropagation () Prevent other event handlers from being called
Event.stoppropagation () Block events from bubbling up to the DOM tree, preventing any parent handlers from being notified of events
Event.target Returns which DOM element triggered the event
Event.timestamp Returns the number of milliseconds from January 1, 1970 to the time the event was triggered
Event.type Returns which type of event is triggered
Event.which Returns which keyboard key or mouse button is pressed on the specified event
Event.metakey Whether the META key is pressed when the event is triggered
Focus () Add/Trigger Focus events
Focusin () Adding an event handler to the Focusin event
Focusout () Adding an event handler to the Focusout event
Hover () Add two event handlers to the hover event
KeyDown () Add/Trigger KeyDown events
KeyPress () Add/Trigger KeyPress events
KeyUp () Add/Trigger KeyUp events
Live () Removed in version 1.9. Add one or more event handlers to the current or future selected element
Load () Deprecated in version 1.8. Add an event handler to the Load event
MouseDown () Add/Trigger MouseDown events
MouseEnter () Add/Trigger MouseEnter events
MouseLeave () Add/Trigger MouseLeave events
MouseMove () Add/Trigger MouseMove events
Mouseout () Add/Trigger Mouseout events
MouseOver () Add/Trigger MouseOver events
MouseUp () Add/Trigger MouseUp events
Off () Remove event handlers added by the On () method
On () Adding an event handler to an element
One () Adds one or more event handlers to the selected element. This handler can only be triggered once by each element
$.proxy () Accepts an existing function and returns a new function with a specific context
Ready () Specifies the function to be executed when the DOM is fully loaded
Resize () Add/Trigger Resize events
Scroll () Add/Trigger Scroll events
Select () Add/Trigger Select Event
Submit () Add/Trigger Submit Event
Toggle () Removed in version 1.9. Add two or more functions to toggle between the Click events
Trigger () Triggers all events bound to the selected element
Triggerhandler () Triggers all functions on the specified event bound to the selected element
Unbind () Removes the added event handler from the selected element
Undelegate () Remove event handlers from current or future selected elements
Unload () Deprecated in version 1.8. Adding an event handler to the Unload event
ContextMenu () Adding an event handler to the ContextMenu event
$.holdready () Used to pause or resume the execution of the. Ready () Event

HTML event-child element event does not trigger parent element event

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.