42
rated 0 times
[
43]
[
1]
/ answers: 1 / hits: 43472
/ 11 Years ago, tue, march 12, 2013, 12:00:00
In javascript is there an easy way to target the parent of a parent?
I'm using this.parentNode
as the element of a function to select the parent, and I tried both this.parent.parentNode
and this.parentNode.parentNode
, but both simply return the direct parent.
I'm trying to affect the div surrounding the div surrounding the 'this'. I did manage to make it work using a simple loop statement that repeats the parentNode selection twice, but I assume there's a better way.
More From » parent