element-helper-lite

Light wait create elements

Usage no npm install needed!

<script type="module">
  import elementHelperLite from 'https://cdn.skypack.dev/element-helper-lite';
</script>

README

element-helper-lite

GitHub package.json version GitHub

Installation

$ npm i -D element-helper-lite

Methods

const elementsCreate: (eArgs: IElementCreate) => HTMLElement
const elementAddToDoc: (el: HTMLElement, location: ElLocation) => void
const elementAddNewToDoc: (eArgs: IElementCreate, location: ElLocation) => HTMLElement

Enums

enum ElLocation

Interfaces

interface IElementCreate

Example

const args: IElementCreate = {
  tag: 'div',
  attribs: {
    id: 'tinybox',
    class: 'gmbox gmbox-window'
  },
  children: [{
    tag: 'div',
    attribs: {
      class: 'gmclose'
    }
  },
  {
    tag: 'div',
    attribs: {
      id: appSettings.fullScreenRealId,
    },
    children: [{
        tag: 'textarea',
        attribs: {
          id: appSettings.tinyId,
          rows: '18',
          cols: '66'
        }
      }]
  },
  {
    tag: 'div',
    attribs: { id: 'za_one', class: 'za' }
  }]
}
elementAddNewToDoc(args, ElLocation.head);