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
- 2.0 Build
- 1.0 Build
const myElement = window.BAO.utils.createElement('div', {
class: 'my-Class',
id: 'my-id',
['data-value']: "Derek"
})
const myElement = createElement('div', {
class: 'my-Class',
id: 'my-id',
['data-value']: "Derek"
})