qns(quiz): describe how to prevent event bubbling (#375)
* Update en-US.mdx Added information on how to prevent event bubbling to help with related follow up questions. * Update en-US.mdx --------- Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
This commit is contained in:
parent
9d7ff69cea
commit
a4bfcf3814
|
|
@ -2,4 +2,4 @@
|
|||
title: Describe event bubbling
|
||||
---
|
||||
|
||||
When an event triggers on a DOM element, it will attempt to handle the event if there is a listener attached, then the event is bubbled up to its parent and the same thing happens. This bubbling occurs up the element's ancestors all the way to the `document`. Event bubbling is the mechanism behind event delegation.
|
||||
When an event triggers on a DOM element, it will attempt to handle the event if there is a listener attached, then the event is bubbled up to its parent and the same thing happens. This bubbling occurs up the element's ancestors all the way to the `document`. Event bubbling is the mechanism behind event delegation. To prevent event bubbling, you can use `event.stopPropagation()`.
|
||||
|
|
|
|||
Loading…
Reference in New Issue