XML DOM isIdProperty


Attr object

Definition and Usage

The isId attribute returns true when the attribute is of ID type (for example, it contains the identifier of the element it belongs to), otherwise it returns false.

Syntax

attrObject.isId


Example

The following code snippet usesloadXMLDoc()put "books.xmlLoad into xmlDoc and return whether the category attribute is an ID attribute of the <book> element:

Example

xmlDoc=loadXMLDoc("books.xml"); x=xmlDoc.getElementsByTagName('book'); for(i=0;i<x.length;i++) { document.write(x.item(i).attributes[0].isId); document.write("<br>"); }

The above code will output:

false

Try it Yourself »

Attr objectother extensions