Function addClass

  • Add class to the element. The second parameter can be a single class name or an array of class names.

    Basic Usage:

    import { addClass } from "mazey";

    const ele = document.querySelector("#box");
    addClass(ele, "test");

    Output:

    <div id="box" class="test"></div>
    

    Advanced Usage:

    import { addClass, genBrowserAttrs } from "mazey";

    const ele = document.querySelector("html");
    addClass(ele, genBrowserAttrs());

    Output:

    <html class="windows desktop webkit chrome"></html>
    

    Parameters

    • ele: MazeyElement
    • cls: string | string[]

    Returns void