The elementAddClass() method adds the specified CSS class name to the specified HTML DOM element.

Syntax

bapi.helper.elementAddClass(el, sClassName)

Parameters

el

The HTML DOM element to add the class to.

sClassName

The CSS class name that will get added to the provided HTML DOM element.

Example

var elem = document.getElementById('foo');
console.log(elem);

bapi.helper.elementAddClass(elem, "new-cls-name");
console.log(elem);