YouTip LogoYouTip

Dom Met Node Hasattributes

# XML DOM hasAttributes() Method * * Node Object](#) * * * ## Definition and Usage The hasAttributes() method returns true if the node has any attributes, otherwise it returns false. ## Syntax nodeObject.hasAttributes() * * * ## Example The following code snippet uses [loadXMLDoc()](#) to load "[books.xml](#)" into xmlDoc and returns whether the first element has any attributes: ## Example xmlDoc=loadXMLDoc("books.xml"); x=xmlDoc.getElementsByTagName('book'); document.write(x.hasAttributes()); Output: true [Try it yourself Β»](#) * * Node Object](#)
← Dom Met Node HaschildnodesProp Node Baseuri β†’