Easy Tutorial
❮ Dom Nodetree Met Cdata Splittext ❯

XML DOM removeAttributeNS() Method



Definition and Usage

The removeAttributeNS() method removes the attribute specified by the namespace and name.

Syntax

Parameter Description
ns Required. Specifies the namespace of the attribute to remove.
name Required. Specifies the name of the attribute to remove.

Example

The following code snippet uses loadXMLDoc() to load "books_ns.xml" into xmlDoc and removes the "lang" attribute from the first <title> element:

Example

xmlDoc=loadXMLDoc("books_ns.xml");

x=xmlDoc.getElementsByTagName("title")[0];
ns="http://www.tutorialpro.org/w3cnote/";

document.write("Attribute Found: ");
document.write(x.hasAttributeNS(ns,"lang"));

x.removeAttributeNS(ns,"lang");

document.write("<br>Attribute Found: ");
document.write(x.hasAttributeNS(ns,"lang"));

Output:

Attribute Found: true
Attribute Found: false

❮ Dom Nodetree Met Cdata Splittext ❯