HTML DOM Attribute specified

Example

Is the style attribute specified?:

document.getElementById("myDiv").getAttributeNode("style").specified
Try it Yourself »

Description

The specified property returns true if an attribute is specified.

Warning

This property returns an error if the attribute is not specified.

This might crash your program.


Syntax

attribute.specified

Return Value

Type Description
A booleantrue if the attribute is specified.
Otherwise it returns an error.

Browser Support

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

It is fully supported in all browsers:

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


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.