dom/getElement

Returns a DOM element by its selector.

Source:

Methods

(static) getElement(selector) → {HTMLElement}

Source:
Example
import { getElement } from '@untemps/utils/dom/getElement'

const element = document.createElement('div')
element.id = 'my-element'
document.body.appendChild(element)

getElement('#my-element') // <div id="my-element"></div>
Parameters:
Name Type Description
selector string

The selector of the DOM element to return.

Returns:

The DOM element corresponding to the selector.

Type
HTMLElement