HTML DOM Attributes specified attribute

definition and usage

if the attribute is specified, then specified attribute returns true.

warning

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

this may cause your program to crash.

example

whether the style attribute has been specified?

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

try it yourself

syntax

attribute.specified

return value

type description
boolean value if specified attribute, then return true. Otherwise return error.

browser support

attribute.specified a cece DOM Level 1 (1998) ga'a.

所有浏览器都支持它:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
支持 9-11 支持 支持 支持 支持