Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <div id="parent">
- <button type="button" id="child">
- click me
- </button>
- </div>
- <script>
- var parent = document.querySelector('#parent');
- var child = document.querySelector('#child');
- parent.addEventListener('click', function(event){
- console.log("I am from parent");
- });
- child.addEventListener('click', function(event){
- console.log("I am from child");
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement