javascript get dom id code example Example: get id of element javascript var element = document.getElementsByTagName("div")[0]; var id = element.id;