HTML DOM Attributes specified attribute

Definition and usage

If the attribute is specified, then specified The attribute returns true.

Warning

If the attribute is not specified, this attribute returns an error.

This may cause your program to crash.

Example

Is the style attribute specified?

document.getElementById("myDiv").getAttributeNode("style").specified

Try it yourself

Syntax

attribute.specified

Return value

Type Description
Boolean value Returns true if the attribute is specified. Otherwise, returns an error.

Browser support

attribute.specified It is a feature of DOM Level 1 (1998).

All browsers support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support