Saltar al contenido principal

Function: useGetDataAttribute()

useGetDataAttribute(target, key): string | undefined

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

Gets a data-* attribute value from the target element.

Parameters

target

string | HTMLElement

A CSS selector string or an HTMLElement instance.

key

string

The data key (without the data- prefix).

Returns

string | undefined

The data attribute value, or undefined.

Example

const id = useGetDataAttribute("tr.row", "userId");