MDN self-hosted library · e01.org

MutationEvent: attrChange property

UI Events

Open notebook · 1 cells web-api-instance-property upstream source

UI Events

The attrChange read-only property of the MutationEvent interface returns a number indicating what kind of change triggered the DOMAttrModified event. The three possible values are MODIFICATION (1), ADDITION (2) or REMOVAL (3). It has no meaning for other events and is then set to 0.

Value

An integer: 0, 1 (MODIFICATION), 2 (ADDITION), or 3 (REMOVAL).

Examples

element.addEventListener("DOMAttrModified", (event) => {
  console.log(event.attrChange);
});

Specifications

Browser compatibility