XML DOM isId attribute

Definition and usage

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

Syntax:

attrObject.isId

Example

In all examples, we will use the XML file books.xml, and JavaScript function loadXMLDoc().

The following code snippet returns whether the category attribute is the ID attribute of the <book> element:

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

The output of the above code should be:

false
false
false
false

TIY

isId - Get whether the attribute is of ID type(IE browser does not support)