Trilium Backend API
    Preparing search index...
    • Add or remove class(es) from the matched elements, depending on either the class's presence or the value of the switch argument. Also accepts a function.

      Type Parameters

      Parameters

      • this: R
      • Optionalvalue:
            | string
            | (
                (
                    this: Element,
                    i: number,
                    className: string,
                    stateVal?: boolean,
                ) => string
            )

        Name of the class. Can also be a function.

      • OptionalstateVal: boolean

        If specified the state of the class.

      Returns R

      The instance itself.

      $('.apple.green').toggleClass('fruit green red').prop('outerHTML');
      //=> <li class="apple fruit red">Apple</li>

      $('.apple.green').toggleClass('fruit green red', true).prop('outerHTML');
      //=> <li class="apple green fruit red">Apple</li>