Saltar al contenido principal

Function: useGetElementByClass()

useGetElementByClass<T>(className): T | null

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

Finds the first element matching a class name.

Type Parameters

T

T extends HTMLElement = HTMLElement

The expected HTMLElement subtype.

Parameters

className

string

A class name, with or without a leading ..

Returns

T | null

The matching element, or null.

Example

const card = useGetElementByClass(".card");
const card2 = useGetElementByClass("card"); // equivalent