Answers for "get all parent nodes of child in javascript array"

0

get all parent nodes of child in javascript array

var a = document.getElementById("target");
var els = [];
while (a) {
    els.unshift(a);
    a = a.parentNode;
}
Posted by: Guest on July-28-2020

Code answers related to "get all parent nodes of child in javascript array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language