Fetching parent node element of a HTML node

Posted on 13-03-2017 by Nadir Latif


Source: https://www.w3schools.com/jsref/prop_node_parentnode.asp

We can fetch the parent node of a html element using following code:


var x = document.getElementById("myLI").parentNode.nodeName;