Saltar al contenido principal

Function: useGetElementById()

useGetElementById<T>(id): T | null

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

Finds an element by its id attribute.

Type Parameters

T

T extends HTMLElement = HTMLElement

The expected HTMLElement subtype.

Parameters

id

string

The element id (without #).

Returns

T | null

The matching element, or null.

Example

const btn = useGetElementById<HTMLButtonElement>("submit-btn");