Skip to main content

createElement

createElement is a convenience method that allows you get create and return Element in JS with a singular function.

danger

The object that gets passed into createElement can only set attributes on the element you're creating. It can't handle things like innerHTML or textContent. This would need to be done after creation of the Element

Usage examples

const myElement = window.BAO.utils.createElement('div', {
class: 'my-Class',
id: 'my-id',
['data-value']: "Derek"
})