Skip to content

Editor / DOM Helper / addClassesOnSelectors

Function: addClassesOnSelectors()

ts
function addClassesOnSelectors(selectors, classesToAdd): void;

Adds the specified CSS classes to multiple DOM elements.

This is a wrapper for handleAddRemoveClassesOnSelectors with the action set to 'add'.

Parameters

ParameterTypeDescription

selectors

string[]

An array of selector strings targeting the elements.

classesToAdd

string[]

An array of CSS class names to add.

Returns

void

Example

ts
// Add the class 'highlight' to multiple elements
addClassesOnSelectors(['#element1', '.element2'], ['highlight']);

Version v1.33.1 - Built on 2026-03-28