Skip to content

Instantly share code, notes, and snippets.

@SidharthArya
Created March 6, 2023 13:14
Show Gist options
  • Save SidharthArya/a92d4e1d7b1ab86250011833130449f2 to your computer and use it in GitHub Desktop.
Save SidharthArya/a92d4e1d7b1ab86250011833130449f2 to your computer and use it in GitHub Desktop.
Get full path of current inspected element
crumb = function(node) {
var idOrClass = (node.id && "#"+node.id) || (""+node.classList && (" "+node.classList).replace(/ /g, "."));
return node.tagName.toLowerCase() + idOrClass;};
crumbPath = function(node) {return node.parentNode ? crumbPath(node.parentNode).concat(crumb(node)) : [];};
crumbPath($0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment