Skip to content

Commit 2d53b22

Browse files
Update README.md
1 parent 351ef5f commit 2d53b22

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,3 +568,17 @@ Example:
568568
`<a href="https://example.com" id="myLink" onclick="PreventDefault(event)">Go to Example</a>`
569569

570570
Normally, clicking the link would take you to example.com. PreventDefault method stops that action and does something else—like showing an alert.
571+
572+
`StopPropagation` prevents the event from occurring on its parent tags.
573+
574+
Example:
575+
576+
`StopPropagation(event)`
577+
578+
```html
579+
<div onclick="alert('DIV clicked!')">
580+
<button onclick="StopPropagation(event)">Click Me</button>
581+
</div>
582+
```
583+
584+
In the above example, the alert is not displayed when the button is clicked.

0 commit comments

Comments
 (0)