<html>
<body>
<p>Example list:</p>
<ul><li>Coffee</li><li>Tea</li></ul>
<p id="demo">Click the button get the node name of the parent node of the first list item in a list</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var x=document.getElementById("demo");
var y=document.getElementsByTagName("LI")[0];
x.innerHTML=y.parentNode.nodeName;
}
</script>
</body>
</html>