html check if item has children code example Example: check if an HTML element has any children if (element.hasChildNodes()) { // It has at least one }