Snippets Collections
function getDef(element, def) {
  var str = ""

  var childs = element.childNodes
  for (var i = 0; i < childs.length; ++i) {
    if (childs[i].nodeType != 3) {
      str += childs[i].nodeName + " " + def + "<br />"
      str += getDef(childs[i], def + 1)
    }
  }

  return str
}


// Example
document.body.innerHTML = getDef(document.body, 0)
add_action( 'wp_body_open', 'wpdoc_add_custom_body_open_code' );
 
function wpdoc_add_custom_body_open_code() {
    echo '<!-- Google Tag Manager (noscript) --> ... <!-- End Google Tag Manager (noscript) -->';
}
star

Mon Aug 07 2023 06:01:42 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/extension/initializing?newuser

#vb.net #tag #1pm #php
star

Wed May 04 2022 12:56:13 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/33903929/iterate-through-html-dom-and-get-depth

#depth #recursive #tag #childnodes
star

Sat Mar 06 2021 03:42:11 GMT+0000 (Coordinated Universal Time) https://rckflr.com

#wordpress #google #tag #manager #function

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension