Element representation of target.
Element, EventTarget, or CSS selector.
Dataset property or attribute name for the dataset entry to remove.
Element representation of the specified 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 Name (data-*)
const element = findElement("#example")!;
removeDatasetEntry(element, "data-label");
Using Property Name (camelCase)
const element = findElement("#example")!;
removeDatasetEntry(element, "label");
HTML (After)
<div
id="example"
data-is-active="false"
data-count="30"
>
...
</div>
Removes the dataset entry with attribute/property name
keyfrom thetarget.