HTML DOM specifiedProperty

 属性对象参考手册Attribute Object

Example

Check whether the attribute has a specified value:

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

Output:

true

Try it Yourself »

Definition and Usage

If the attribute value is set in the document, the specified property returns true; if it is a default value in DTD/Schema, it returns false.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the specified property


Syntax

attribute.specified

Technical Details

Return Value: Boolean, true|false
DOM Version Core Level 1


 属性对象参考手册Attribute Object

Other Extensions