UseGetAttribute
katanakit-js / useGetAttribute
Function: useGetAttribute()
Section titled “Function: 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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
target |
string | Element |
A CSS selector string or an Element instance. |
attr |
string |
The attribute name. |
Returns
Section titled “Returns”string | null
The attribute value, or null if not present or element not found.
Example
Section titled “Example”const href = useGetAttribute("a.link", "href");