{"id":7538,"date":"2021-08-07T09:22:38","date_gmt":"2021-08-07T09:22:38","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=7538"},"modified":"2022-04-13T16:30:46","modified_gmt":"2022-04-13T16:30:46","slug":"how-to-traverse-the-dom-in-javascript","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/","title":{"rendered":"How To Traverse The DOM In JavaScript?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>DOM Traversal<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>parentNode \u2013 Returns parent node<\/strong><\/li><li><strong>parentElement \u2013 Returns parent element node<\/strong><\/li><li><strong>childNodes \u2013 Returns collection of an element\u2019s child nodes (including text and comment nodes)<\/strong><\/li><li><strong>children \u2013 Returns a collection of an element\u2019s child element node (do not include text and comment nodes)<\/strong><\/li><li><strong>firstChild \u2013 Returns first child node of an element (it can be text or comment node)<\/strong><\/li><li><strong>firstElementChild \u2013 Returns first child element node of an element<\/strong><\/li><li><strong>lastChild &#8211; Returns last child node of an element (it can be text or comment node)<\/strong><\/li><li><strong>lastElementChild \u2013 Returns last child element node of an element<\/strong><\/li><li><strong>previousSibling &#8211; Returns previous node of the same level (it can be text or comment node)<\/strong><\/li><li><strong>previousElementSibling \u2013 Returns previous element node of the same level<\/strong><\/li><li><strong>nextSibling &#8211; Returns next node of same level (it can be text or comment node)<\/strong><\/li><li><strong>nextElementSibling \u2013 Returns next element of same level<\/strong><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>parentNode and parentElement<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The parentNode read-only property returns the parent of the specified node in the DOM tree.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The parentElement property returns the parent element of the specified element. If the parent node is not an element node, it returns null.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"631\" height=\"296\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2.png\" alt=\"\" class=\"wp-image-7552\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2.png 631w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2-300x141.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>childNodes<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The childNode<strong>s<\/strong> read-only property returns a live NodeList of child nodes of the given element where the first child node is assigned index 0. childNodes includes all child nodes, including non-element nodes like text and comment nodes.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Whitespace inside elements is considered as text, and text is considered as nodes.<\/li><li>Any whitespace will create a #text node, from a single space to multiple spaces, returns, tabs, and so on.<\/li><li>You can use the length property of the NodeList object to determine the number of child nodes, then you can loop through all child nodes and extract the other info.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>children<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The children property returns collection of child elements of the given element where the first child is assigned index 0. children include only element nodes (no whitespace, text node, and comment node).<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>You can use the length property of the NodeList object to determine the number of child nodes, then you can loop through all child nodes and extract the other info.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>firstChild<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The firstChild property returns the node&#8217;s first child in the tree, or null if the node has no children. If the node is a Document, it returns the first node in the list of its direct children. It includes a text node and a comment node.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Whitespace inside elements is considered as text, and text is considered as nodes.<\/li><li>Any whitespace will create a #text node, from a single space to multiple spaces, returns, tabs, and so on.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>firstElementChild<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The firstElementChild property returns the element&#8217;s first child element node in the tree, or null if the node has no children element. It ignores text node and comment node or any whitespaces.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"631\" height=\"296\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-1.png\" alt=\"\" class=\"wp-image-7550\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-1.png 631w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-1-300x141.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>lastChild<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The lastChild read-only property returns the last child of the node. If its parent is an element, then the child is generally an element node, a text node, or a comment node. It returns null if there are no child elements.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Whitespace inside elements is considered as text, and text is considered as nodes.<\/li><li>Any whitespace will create a #text node, from a single space to multiple spaces, returns, tabs, and so on.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>lastElementChild<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The lastElementChild property returns the element&#8217;s last child element node in the tree, or null if the node has no children element. It ignores text node and comment node or any whitespaces.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"631\" height=\"296\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document.png\" alt=\"\" class=\"wp-image-7547\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document.png 631w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-300x141.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>previousSibling<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The previousSibling read-only property returns the node immediately preceding the specified one in its parent&#8217;s childNodes list, or null if the specified node is the first in that list. It includes text node and comment node or any whitespace.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>previousElementSibling<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The previousElementSibling property returns the element node immediately preceding the specified one in its parent&#8217;s node list, or null if the specified node is the first in that list. It ignores the text node and comment node or any whitespace.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"635\" height=\"292\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-2.png\" alt=\"\" class=\"wp-image-7545\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-2.png 635w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-2-300x138.png 300w\" sizes=\"auto, (max-width: 635px) 100vw, 635px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>nextSibling<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The nextSibling read-only property returns the node immediately following the specified one in its parent&#8217;s childNodes list, or null if the specified node is the last node in that list. It includes text node and comment node or any whitespace.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>nextElementSibling<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The nextElementSibling read-only property returns the element node immediately following the specified one in its parent&#8217;s node list, or null if the specified node is the last node in that list. It ignores the text node and comment node or any whitespace.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"639\" height=\"307\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node.png\" alt=\"\" class=\"wp-image-7544\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node.png 639w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-300x144.png 300w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>ownerDocument<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The ownerDocument read-only property returns the top-level document object for this node. In HTML, the HTML document itself is always the ownerDocument of an element.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DOM Traversal parentNode \u2013 Returns parent node parentElement \u2013 Returns parent element node childNodes \u2013 Returns collection of an element\u2019s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[16],"tags":[6045,4459,5095,1543],"class_list":["post-7538","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-dom-traversal","tag-html","tag-javascript","tag-node"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Traverse The DOM In JavaScript? - scmGalaxy<\/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:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Traverse The DOM In JavaScript? - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"DOM Traversal parentNode \u2013 Returns parent node parentElement \u2013 Returns parent element node childNodes \u2013 Returns collection of an element\u2019s [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-07T09:22:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-13T16:30:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2.png\" \/>\n<meta name=\"author\" content=\"rajeshkumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rajeshkumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/\"},\"author\":{\"name\":\"rajeshkumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"headline\":\"How To Traverse The DOM In JavaScript?\",\"datePublished\":\"2021-08-07T09:22:38+00:00\",\"dateModified\":\"2022-04-13T16:30:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/\"},\"wordCount\":765,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/element-node-document-2.png\",\"keywords\":[\"DOM Traversal\",\"HTML\",\"Javascript\",\"Node\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/\",\"name\":\"How To Traverse The DOM In JavaScript? - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/element-node-document-2.png\",\"datePublished\":\"2021-08-07T09:22:38+00:00\",\"dateModified\":\"2022-04-13T16:30:46+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/element-node-document-2.png\",\"contentUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/element-node-document-2.png\",\"width\":631,\"height\":296},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/how-to-traverse-the-dom-in-javascript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Traverse The DOM In JavaScript?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\",\"name\":\"rajeshkumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"caption\":\"rajeshkumar\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/rajeshkumar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Traverse The DOM In JavaScript? - scmGalaxy","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:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How To Traverse The DOM In JavaScript? - scmGalaxy","og_description":"DOM Traversal parentNode \u2013 Returns parent node parentElement \u2013 Returns parent element node childNodes \u2013 Returns collection of an element\u2019s [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/","og_site_name":"scmGalaxy","article_published_time":"2021-08-07T09:22:38+00:00","article_modified_time":"2022-04-13T16:30:46+00:00","og_image":[{"url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2.png","type":"","width":"","height":""}],"author":"rajeshkumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rajeshkumar","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/"},"author":{"name":"rajeshkumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"headline":"How To Traverse The DOM In JavaScript?","datePublished":"2021-08-07T09:22:38+00:00","dateModified":"2022-04-13T16:30:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/"},"wordCount":765,"commentCount":0,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2.png","keywords":["DOM Traversal","HTML","Javascript","Node"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/","name":"How To Traverse The DOM In JavaScript? - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2.png","datePublished":"2021-08-07T09:22:38+00:00","dateModified":"2022-04-13T16:30:46+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/#primaryimage","url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2.png","contentUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2021\/08\/element-node-document-2.png","width":631,"height":296},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/how-to-traverse-the-dom-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"How To Traverse The DOM In JavaScript?"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361","name":"rajeshkumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","caption":"rajeshkumar"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/rajeshkumar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=7538"}],"version-history":[{"count":2,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7538\/revisions"}],"predecessor-version":[{"id":7553,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/7538\/revisions\/7553"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=7538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=7538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=7538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}