Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM removeAttributeNS() Method

XML DOM removeAttributeNS() Method


Element Object Reference Element Object


Definition and Usage

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

Syntax

elementNode.removeAttributeNS(ns,name)

Parameters Description
ns Required. Specifies the namespace of the attribute to remove.
name Required. Specifies the name of the attribute to be removed.

Example

The following code snippet uses loadXMLDoc() to load "books_ns.xml" load into xmlDoc, and delete the first the "lang" attribute of an element: </p>

Example

xmlDoc

=

loadXMLDoc

(

"

books_ns.xml

"

)

;

x

=

xmlDoc

.

getElementsByTagName

(

"

title

"

)

[

0

]

;

ns

=

"

http://www.runoob.com/w3cnote/

"

;

document

.

write

(

"

Attribute Found:

"

)

;

document

.

write

(

x

.

hasAttributeNS

(

ns

,

"

lang

"

)

)

;

x

.

removeAttributeNS

(

ns

,

"

lang

"

)

;

document

.

write

(

"


Attribute Found:

"

)

;

document

.

write

(

x

.

hasAttributeNS

(

ns

,

"

lang

"

)

)

;

Output:

Attribute Found: true

Attribute Found: false

Try it »


Element Object Reference Element Object