I want to check if the element is not directly inside a div
.
For example Consider the follwing markup-
If I place a div
inside another div
.
Then I could use this code-
if(document.getElementById('innerDiv').parentElement.id == 'outerDiv') )
where innerdiv is inside the outerdiv.
But what if I place four div's
inside one another then how can i check that any div is inside the given div.
there may be a better option than using this code
innerelem.parentnode.parentnode.parentnode.parentnode
I hope i was able to explain what i want to do????