Movatterモバイル変換


[0]ホーム

URL:


  1. Glossary
  2. Attribute

Attribute

Anattribute extends anHTML orXMLelement, changing its behavior or providing metadata.

An attribute always has the formname="value" (the attribute's identifier followed by its associated value). You may see attributes without an equals sign or a value. That is a shorthand for providing the empty string in HTML. However, this is not valid in XML: XML requires all attributes to have an explicit value.

A number of HTML attributes areboolean attributes. These attributes' values are only controlled by the presence or absence of the attribute. Seeboolean attributes for more information.

Reflection of an attribute

Attributes may bereflected into a particular property of the specific interface.

This means that the value of the attribute can be read or written directly in JavaScript through a property on the corresponding interface, and vice versa.The reflected properties offer a more natural programming approach than getting and setting attributes using thegetAttribute() andsetAttribute() methods of theElement interface.

For more information seeAttribute reflection.

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp