XML DOM prefixProperty


Element object

Definition and Usage

The prefix property returns the namespace prefix of the selected element.

If the selected node is not an element or an attribute, this property always returns NULL.

Syntax

elementNode.prefix

Example

The following code snippet usesloadXMLDoc()put "books_ns.xmlLoad into xmlDoc and retrieve the namespace prefix from the first `<title>` element:

Example

xmlDoc=loadXMLDoc("books_ns.xml");
x=xmlDoc.getElementsByTagName("title")[0];

document.write(x.prefix);

The above code will output:

c

Try it Yourself »

Element objectother extensions