Function: setClass()
ts
function setClass(el, className): void;Sets the class attribute or className property of an element to the specified value.
Parameters
| Parameter | Type | Description |
|---|---|---|
el | HTMLElement | SVGElement | The element to set the class attribute/property for. |
className | string | The class name(s) to set on the element. |
Returns
void
Example
ts
const el = document.createElement('div')
setClass(el, 'my-class')
console.log(el.className)Since
1.0.0