You can use the parentElement property in JavaScript to get the parent element of a child tag. Here's an example:

HTML:

<div id="parent">
  <p id="child">Hello</p>
</div>

JavaScript:

const childElement = document.getElementById("child");
const parentElement = childElement.parentElement;
console.log(parentElement.tagName); // Output: "DIV"

In this example, we get the child element with the ID "child" and then use the parentElement property to get its parent element. We can then use the tagName property to get the name of the parent element

Knowing the value of a child tag in HTML how can I get the name of its parent tag