domData.set
Set data to be associated with a DOM node using the specified key
.
If data already exists for this key, it will be overwritten.
domData.set(node, key, value)
Parameters
- node
{Node}
:The element.
- key
{String}
:The property under which to store the value.
- value
{*}
:The value to store for the key.
Use
import domData from "can-dom-data";
const element = document.createElement("p");
document.body.appendChild(element);
domData.set(element, "metadata", {
hello: "world"
});