YouTip LogoYouTip

Dom Met Element Removeattribute

# XML DOM removeAttribute() Method * * Element Object](#) * * * ## Definition and Usage The removeAttribute() method removes a specified attribute. If the attribute's default value is defined in the DTD, the new attribute will appear with that default value. ## Syntax elementNode.removeAttribute(name) | Parameter | Description | | :--- | :--- | | name | Required. Specifies the attribute to remove. | * * * ## Example The following code snippet uses [loadXMLDoc()](#) to load "[books.xml](#)" into xmlDoc and removes the "category" attribute from all elements: ## Example xmlDoc=loadXMLDoc("books.xml"); x=xmlDoc.getElementsByTagName('book'); document.write(x.getAttribute('category')); document.write("
"); x.removeAttribute('category'); document.write(x.getAttribute('category')); [Try it Β»](#) * * Element Object](#)
← Prop Cdata LengthMet Element Lookupprefix β†’