UseHasClass
katanakit-js / useHasClass
Function: useHasClass()
Section titled “Function: useHasClass()”function useHasClass(target, className): boolean;Defined in: infrastructure/dom/dom.service.ts:215
Checks whether the target element has a given CSS class.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
target |
string | Element |
A CSS selector string or an Element instance. |
className |
string |
The class name to check. |
Returns
Section titled “Returns”boolean
true if the class exists, false otherwise.
Example
Section titled “Example”if (useHasClass(".btn", "disabled")) { // button is disabled}