how to retrieve parent id of child js code example Example: get parent id javascript var x = document.getElementById("ID").parentElement.nodeName;