{"id":18106,"date":"2017-01-10T19:29:24","date_gmt":"2017-01-10T19:29:24","guid":{"rendered":"https:\/\/jsforwp.dbemyj3z-liquidwebsites.com\/?p=18106"},"modified":"2017-05-30T08:39:06","modified_gmt":"2017-05-30T08:39:06","slug":"dom-event-propagation-javascript-capturing-bubbling-explained","status":"publish","type":"post","link":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/","title":{"rendered":"DOM Event Propagation with JavaScript &#8211; Capturing and Bubbling Explained"},"content":{"rendered":"<h2>Basic Terms Explained<\/h2>\n<p>Event propagation is an important yet little understood topic. In this post and related video we will go in depth into event propagation, explaining the terms capturing and bubbling and showing examples of when and how to use each.<\/p>\n<ul>\n<li>Event propagation &#8211; An overarching term that includes the three different phases of DOM Events: capturing, targeting and bubbling.<\/li>\n<li>Capturing Phase &#8211; When an event occurs in the DOM, notification of the event is passed starting at the top of the DOM tree and passing down through all parent element nodes all the way to the target node where the event occurred.<\/li>\n<li>Target Phase &#8211; After the capturing phase occurs, the Target phase occurs. The target phase only includes a notification of Node where the event took place.<\/li>\n<li>Bubbling Phase &#8211; This is the final phase to occur, although many people think this is the first phase. In the bubbling phase a notice is passed from the target Node up through all of the parent Nodes all the way back to the top root of the DOM.<\/li>\n<\/ul>\n<h2>Event Propagation, Capturing and Bubbling Video<\/h2>\n<p><iframe loading=\"lazy\" title=\"Event Propagation Explained (w Bubbling and Capturing)\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/BtOrr7oTH_8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>Code Samples Used: <a href=\"https:\/\/javascriptforwp.com\/wp-content\/uploads\/2016\/04\/1.4.6-Event-Propagation.zip\">Download<\/a><\/p>\n<h2>Taking it Further with Learning JavaScript<\/h2>\n<p>Now that you have learned the basics of event propagation it is important for you to build out a demo like the one you have seen in the video above.<\/p>\n<p>If this content was a little advanced for you, you can go back and watch our <a href=\"https:\/\/javascriptforwp.com\/introduction-to-events-in-the-dom-with-javascript\/\" target=\"_blank\" rel=\"noopener noreferrer\">Introduction to JavaScript Events video<\/a>. Or if you\u2019re looking to take things further, check out our <a href=\"https:\/\/javascriptforwp.com\/introduction-local-storage-javascript\/\" target=\"_blank\" rel=\"noopener noreferrer\">Local Storage video<\/a>.<\/p>\n<p>To take your learning even further, <a href=\"https:\/\/javascriptforwp.com\/#enroll\" target=\"_blank\" rel=\"noopener noreferrer\">reserve a seat for the JavaScript for WordPress Master Course<\/a>. We cover everything you need to know about Events and much much more!!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Basic Terms Explained Event propagation is an important yet little understood topic. In this post and related video we will go in depth into event propagation, explaining the terms capturing and bubbling and showing examples of when and how to use each. Event propagation &#8211; An overarching term that includes the three different phases of [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[135],"tags":[],"class_list":["post-18106","post","type-post","status-publish","format-standard","hentry","category-free-videos"],"acf":[],"featured_image_urls":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":"","course_icon":"","course_banner":"","latest-full-width":"","latest-grid-thumb":"","latest-grid-thumb-masonry":"","latest-woo-thumb":"","latest-nav-thumb":"","latest-mega-thumb":"","latest-fixed-thumb":"","latest-hero":"","latest-single":"","latest-hero-thumb":"","latest-logo":"","woocommerce_thumbnail":"","woocommerce_single":"","woocommerce_gallery_thumbnail":""},"post_excerpt_stackable":"<p>Basic Terms Explained Event propagation is an important yet little understood topic. In this post and related video we will go in depth into event propagation, explaining the terms capturing and bubbling and showing examples of when and how to use each. Event propagation &#8211; An overarching term that includes the three different phases of DOM Events: capturing, targeting and bubbling. Capturing Phase &#8211; When an event occurs in the DOM, notification of the event is passed starting at the top of the DOM tree and passing down through all parent element nodes all the way to the target node&hellip;<\/p>\n","category_list":"<a href=\"https:\/\/javascriptforwp.com\/category\/free-videos\/\" rel=\"category tag\">Free Videos<\/a>","author_info":{"name":"Zac Gordon","url":"https:\/\/javascriptforwp.com\/author\/zgordon\/"},"comments_num":"0 comments","featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":"","course_icon":"","course_banner":"","latest-full-width":"","latest-grid-thumb":"","latest-grid-thumb-masonry":"","latest-woo-thumb":"","latest-nav-thumb":"","latest-mega-thumb":"","latest-fixed-thumb":"","latest-hero":"","latest-single":"","latest-hero-thumb":"","latest-logo":"","woocommerce_thumbnail":"","woocommerce_single":"","woocommerce_gallery_thumbnail":""},"post_excerpt_stackable_v2":"<p>Basic Terms Explained Event propagation is an important yet little understood topic. In this post and related video we will go in depth into event propagation, explaining the terms capturing and bubbling and showing examples of when and how to use each. Event propagation &#8211; An overarching term that includes the three different phases of DOM Events: capturing, targeting and bubbling. Capturing Phase &#8211; When an event occurs in the DOM, notification of the event is passed starting at the top of the DOM tree and passing down through all parent element nodes all the way to the target node&hellip;<\/p>\n","category_list_v2":"<a href=\"https:\/\/javascriptforwp.com\/category\/free-videos\/\" rel=\"category tag\">Free Videos<\/a>","author_info_v2":{"name":"Zac Gordon","url":"https:\/\/javascriptforwp.com\/author\/zgordon\/"},"comments_num_v2":"0 comments","yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DOM Event Propagation with JavaScript - Capturing and Bubbling Explained - JavaScript for WordPress<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DOM Event Propagation with JavaScript - Capturing and Bubbling Explained - JavaScript for WordPress\" \/>\n<meta property=\"og:description\" content=\"Basic Terms Explained Event propagation is an important yet little understood topic. In this post and related video we will go in depth into event propagation, explaining the terms capturing and bubbling and showing examples of when and how to use each. Event propagation &#8211; An overarching term that includes the three different phases of [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/\" \/>\n<meta property=\"og:site_name\" content=\"JavaScript for WordPress\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-10T19:29:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-05-30T08:39:06+00:00\" \/>\n<meta name=\"author\" content=\"Zac Gordon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/zgordon\" \/>\n<meta name=\"twitter:site\" content=\"@zgordon\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Zac Gordon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/\"},\"author\":{\"name\":\"Zac Gordon\",\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#\\\/schema\\\/person\\\/76dfb19fbd859b4a17428b8b17767b25\"},\"headline\":\"DOM Event Propagation with JavaScript &#8211; Capturing and Bubbling Explained\",\"datePublished\":\"2017-01-10T19:29:24+00:00\",\"dateModified\":\"2017-05-30T08:39:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/\"},\"wordCount\":305,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#organization\"},\"articleSection\":[\"Free Videos\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/\",\"url\":\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/\",\"name\":\"DOM Event Propagation with JavaScript - Capturing and Bubbling Explained - JavaScript for WordPress\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#website\"},\"datePublished\":\"2017-01-10T19:29:24+00:00\",\"dateModified\":\"2017-05-30T08:39:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/dom-event-propagation-javascript-capturing-bubbling-explained\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/javascriptforwp.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DOM Event Propagation with JavaScript &#8211; Capturing and Bubbling Explained\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#website\",\"url\":\"https:\\\/\\\/javascriptforwp.com\\\/\",\"name\":\"JavaScript for WordPress\",\"description\":\"Tutorials, Courses, Bootcamps and Conferences\",\"publisher\":{\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/javascriptforwp.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#organization\",\"name\":\"JavaScript for WordPress Master Course\",\"url\":\"https:\\\/\\\/javascriptforwp.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/javascriptforwp.com\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/wapuu-square.png\",\"contentUrl\":\"https:\\\/\\\/javascriptforwp.com\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/wapuu-square.png\",\"width\":200,\"height\":200,\"caption\":\"JavaScript for WordPress Master Course\"},\"image\":{\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/zgordon\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/javascriptforwp.com\\\/#\\\/schema\\\/person\\\/76dfb19fbd859b4a17428b8b17767b25\",\"name\":\"Zac Gordon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7935c73cce64694600738d5ed4a6e464d2ba445af9a7ba375708a815dc90b585?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7935c73cce64694600738d5ed4a6e464d2ba445af9a7ba375708a815dc90b585?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7935c73cce64694600738d5ed4a6e464d2ba445af9a7ba375708a815dc90b585?s=96&d=mm&r=g\",\"caption\":\"Zac Gordon\"},\"description\":\"Zac Gordon is a professional educator, with a current focus on JavaScript development with and alongside WordPress. Zac has years of experience teaching at high schools, colleges, bootcamps and online learning sites like Treehouse, Udemy and Frontend Masters.\",\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/zgordon\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/zgordon\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DOM Event Propagation with JavaScript - Capturing and Bubbling Explained - JavaScript for WordPress","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/","og_locale":"en_US","og_type":"article","og_title":"DOM Event Propagation with JavaScript - Capturing and Bubbling Explained - JavaScript for WordPress","og_description":"Basic Terms Explained Event propagation is an important yet little understood topic. In this post and related video we will go in depth into event propagation, explaining the terms capturing and bubbling and showing examples of when and how to use each. Event propagation &#8211; An overarching term that includes the three different phases of [&hellip;]","og_url":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/","og_site_name":"JavaScript for WordPress","article_published_time":"2017-01-10T19:29:24+00:00","article_modified_time":"2017-05-30T08:39:06+00:00","author":"Zac Gordon","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/zgordon","twitter_site":"@zgordon","twitter_misc":{"Written by":"Zac Gordon","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/#article","isPartOf":{"@id":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/"},"author":{"name":"Zac Gordon","@id":"https:\/\/javascriptforwp.com\/#\/schema\/person\/76dfb19fbd859b4a17428b8b17767b25"},"headline":"DOM Event Propagation with JavaScript &#8211; Capturing and Bubbling Explained","datePublished":"2017-01-10T19:29:24+00:00","dateModified":"2017-05-30T08:39:06+00:00","mainEntityOfPage":{"@id":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/"},"wordCount":305,"commentCount":0,"publisher":{"@id":"https:\/\/javascriptforwp.com\/#organization"},"articleSection":["Free Videos"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/","url":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/","name":"DOM Event Propagation with JavaScript - Capturing and Bubbling Explained - JavaScript for WordPress","isPartOf":{"@id":"https:\/\/javascriptforwp.com\/#website"},"datePublished":"2017-01-10T19:29:24+00:00","dateModified":"2017-05-30T08:39:06+00:00","breadcrumb":{"@id":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/javascriptforwp.com\/dom-event-propagation-javascript-capturing-bubbling-explained\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/javascriptforwp.com\/"},{"@type":"ListItem","position":2,"name":"DOM Event Propagation with JavaScript &#8211; Capturing and Bubbling Explained"}]},{"@type":"WebSite","@id":"https:\/\/javascriptforwp.com\/#website","url":"https:\/\/javascriptforwp.com\/","name":"JavaScript for WordPress","description":"Tutorials, Courses, Bootcamps and Conferences","publisher":{"@id":"https:\/\/javascriptforwp.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/javascriptforwp.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/javascriptforwp.com\/#organization","name":"JavaScript for WordPress Master Course","url":"https:\/\/javascriptforwp.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/javascriptforwp.com\/#\/schema\/logo\/image\/","url":"https:\/\/javascriptforwp.com\/wp-content\/uploads\/2016\/03\/wapuu-square.png","contentUrl":"https:\/\/javascriptforwp.com\/wp-content\/uploads\/2016\/03\/wapuu-square.png","width":200,"height":200,"caption":"JavaScript for WordPress Master Course"},"image":{"@id":"https:\/\/javascriptforwp.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/zgordon"]},{"@type":"Person","@id":"https:\/\/javascriptforwp.com\/#\/schema\/person\/76dfb19fbd859b4a17428b8b17767b25","name":"Zac Gordon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7935c73cce64694600738d5ed4a6e464d2ba445af9a7ba375708a815dc90b585?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7935c73cce64694600738d5ed4a6e464d2ba445af9a7ba375708a815dc90b585?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7935c73cce64694600738d5ed4a6e464d2ba445af9a7ba375708a815dc90b585?s=96&d=mm&r=g","caption":"Zac Gordon"},"description":"Zac Gordon is a professional educator, with a current focus on JavaScript development with and alongside WordPress. Zac has years of experience teaching at high schools, colleges, bootcamps and online learning sites like Treehouse, Udemy and Frontend Masters.","sameAs":["https:\/\/twitter.com\/zgordon","https:\/\/x.com\/https:\/\/twitter.com\/zgordon"]}]}},"_links":{"self":[{"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/posts\/18106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/comments?post=18106"}],"version-history":[{"count":0,"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/posts\/18106\/revisions"}],"wp:attachment":[{"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/media?parent=18106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/categories?post=18106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javascriptforwp.com\/wp-json\/wp\/v2\/tags?post=18106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}