Element representation of target.
elements!InvalidElementError if the specified target wasn't found.
HTML (Before)
<div
id="example"
data-is-active="false"
data-count="30"
data-label="Example"
>
...
</div>
Using Attribute Names (data-*)
const element = findElement("#example")!;
setDatasetEntries(element, {
"data-is-active", true,
"data-count": 50,
"data-label": "Update",
});
Using Property Names (camelCase)
const element = findElement("#example")!;
setDatasetEntries(element, {
isActive, true,
count: 50,
label: "Update",
});
HTML (After)
<div
id="example"
data-is-active="true"
data-count="50"
data-label="Update"
>
...
</div>
Assigns the
datasetkey/value pairs to thetarget.