xxxxxxxxxx
var parent = element.parentElement;
//OR
e.target.parentNode //target parent
<div>
<span onclick="this.parentElement.style.display = 'none';">x</span>
</div>
xxxxxxxxxx
// Get the reference to the element whose parent we want to access
const childElement = document.getElementById('child-element-id');
// Use parentNode property to access the parent element
const parentElement = childElement.parentNode;
// Now you can work with the parent element as needed
console.log(parentElement);
xxxxxxxxxx
// Get the parent div element
var parentDiv = document.querySelector("div").parentElement;
// Do something with the parent div element
console.log(parentDiv);
xxxxxxxxxx
// Get the parent element of a specific element
const element = document.querySelector('#elementId'); // Replace 'elementId' with the actual ID of the element
const parentElement = element.parentElement;
xxxxxxxxxx
// Assuming 'element' is the reference to the element for which we want to find the parent
const parentElement = element.parentElement;