Getting the parent div of element
This should be really simple but I'm having trouble with it. How do I get a parent div of a child element?
My HTML:
<div id="test">
<p id="myParagraph">Testing</p>
</div>
My JavaScript:
var pDoc = document.getElementById("myParagraph");
var parentDiv = ??????????
I would have thought or would work but I keep getting errors. Note that the is defined, just not certain variables of it.document.parent
parent.container
not defined
pDoc
Any ideas?
P.S. I would prefer to avoid jQuery if possible.