Saltar al contenido principal

Function: useGetAttribute()

useGetAttribute(target, attr): string | null

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

Gets the value of an attribute from the target element.

Parameters

target

string | Element

A CSS selector string or an Element instance.

attr

string

The attribute name.

Returns

string | null

The attribute value, or null if not present or element not found.

Example

const href = useGetAttribute("a.link", "href");