Skip to main content

Home > blockly > utils > dom > hasClass

utils.dom.hasClass() function

Checks if an element has the specified CSS class.

Signature:

export declare function hasClass(element: Element, className: string): boolean;

Parameters

ParameterTypeDescription
elementElementDOM element to check.
classNamestringName of class to check.

Returns:

boolean

True if class exists, false otherwise.