how to get a parent element of an element javascript

JavaScript
var parent = document.getElementById("myElement").parentElement; document.body.parentNode; // Returns the <html> element
document.body.parentElement; // Returns the <html> element

document.documentElement.parentNode; // Returns the Document node
document.documentElement.parentElement; // Returns null (<html> does not have a parent ELEMENT node) 
Source

Also in JavaScript: