Skip to content

UseHasClass

katanakit-js / useHasClass

function useHasClass(target, className): boolean;

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

Checks whether the target element has a given CSS class.

Parameter Type Description
target string | Element A CSS selector string or an Element instance.
className string The class name to check.

boolean

true if the class exists, false otherwise.

if (useHasClass(".btn", "disabled")) {
// button is disabled
}