Skip to content

UseGetAttribute

katanakit-js / useGetAttribute

function useGetAttribute(target, attr): string | null;

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

Gets the value of an attribute from the target element.

Parameter Type Description
target string | Element A CSS selector string or an Element instance.
attr string The attribute name.

string | null

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

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