Skip to content
0

katanakit-js / useSetDataAttribute

Function: useSetDataAttribute() ​

ts
function useSetDataAttribute(
   target, 
   key, 
   value
): void;

Defined in: src/infrastructure/dom/dom.service.ts:336

Sets a data-* attribute on the target element.

Parameters ​

ParameterTypeDescription
targetstring | HTMLElementA CSS selector string or an HTMLElement instance.
keystringThe data key (without the data- prefix).
valuestringThe value to set.

Returns ​

void

Example ​

ts
useSetDataAttribute("tr.row", "status", "active");

Released under the MIT License.