Skip to content

Instantly share code, notes, and snippets.

Created December 23, 2017 16:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Event Capturing
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Event Capturing</title>
<div id="parent">
<button id="child">Child</button>
var parent = document.querySelector('#parent');
var child = document.querySelector('#child');
parent.addEventListener('click', function(){
console.log("Parent clicked");
child.addEventListener('click', function(){
console.log("Child clicked");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment