+ 1
Do DOM have grandparent?
Say for example the Dom tree goes: Html Head Title And the head is the parent of title, and html is parent of head. Would this mean html is the grandparent of title or does that not exist :/
2 Answers
+ 5
Yes, you could say that.
The word "grandparent" doesn't translate to any property or method names in the DOM classes, though. There are properties such as parentNode. To get the title element's grandparent, you could do something like title.parentNode.parentNode assuming title was a variable of type DOMElement.
0
Ok Josh Greig :)