Back to Content

StylePropertyMap: clear() method

files/en-us/web/api/stylepropertymap/clear/index.md

latest678 B
Original Source

{{APIRef("CSS Typed Object Model API")}}

The clear() method of the {{domxref("StylePropertyMap")}} interface removes all declarations in the StylePropertyMap.

Syntax

js-nolint
clear()

Parameters

None.

Return value

None ({{jsxref("undefined")}}).

Examples

The following example removes all styles within the elements style attribute.

js
// get the button element
const buttonEl = document.querySelector(".example");

// remove all styles from the style attribute
buttonEl.attributeStyleMap.clear();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}