HTML DOM isIdProperty

属性对象参考手册Attr Object

Example

Check whether the attribute is an ID attribute of the element:

document.getElementById("demo").attributes[0].isId;

Output:

true

Try it yourself »

Definition and Usage

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Except for Internet Explorer and Opera, all other major browsers support the isId property.


Syntax

attribute.isId

Technical Details

Return value: Boolean, true|false
DOM Version Core Level 3


属性对象参考手册Attr Object

Other Extensions