• Removes the dataset entries with the attribute/property names keys from the target.

    Type Parameters

    • TN extends TagName = "*"

      Tag name of the Element representation of target.

    Parameters

    • target: null | Target<TN>

      Element, EventTarget, or CSS selector.

    • keys: string[]

      Array of dataset properties or attribute names to remove.

    Returns ElementOf<TN>

    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 Names (data-*)

    const element = findElement("#example")!;

    removeDatasetEntries(element, ["data-label", "data-count"]);

    Using Property Names (camelCase)

    const element = findElement("#example")!;

    removeDatasetEntries(element, ["label", "count"]);

    HTML (After)

    <div
    id="example"
    data-is-active="false"
    >
    ...
    </div>