get the parent node id with class in javascript code example Example: get parent id javascript var x = document.getElementById("ID").parentElement.nodeName;