@untemps/utils - v3.1.0
    Preparing search index...

    Function modifyElement

    • Parameters

      • element: string | HTMLElement

        The DOM element or selector of the DOM element to modify.

      • attributes: Record<string, string | null | undefined> = {}

        The new attributes to set to the DOM element.

      Returns HTMLElement | null

      The modified DOM element.

      import { modifyElement } from '@untemps/utils/dom/modifyElement'

      const element = document.createElement('div')
      element.className = 'foo'
      document.body.appendChild(element)

      modifyElement(element, { className: 'bar' }) // <div class="bar"></div>