map.apps Bundle APIs 4.20.0
    Preparing search index...

    Function createElement

    • Creates a new HTML node with the given tag.

      For example, to create new div and insert it as the last element of parent:

      import { createElement } from "apprt-dom";
      const parent = document.body;
      const node = createElement("div", {
      class: "app",
      referenceNode: parent
      });

      Type Parameters

      • Tag extends keyof HTMLElementTagNameMap

      Parameters

      • tagName: Tag

        The node's tag, e.g. "div".

      • Optionaloptions: CreateOptions

        Additional settings to customize the node creation.

      Returns HTMLElementForTag<Tag>

    • Creates a new HTML node with the given tag.

      For example, to create new div and insert it as the last element of parent:

      import { createElement } from "apprt-dom";
      const parent = document.body;
      const node = createElement("div", {
      class: "app",
      referenceNode: parent
      });

      Parameters

      • tagName: string

        The node's tag, e.g. "div".

      • Optionaloptions: CreateOptions

        Additional settings to customize the node creation.

      Returns HTMLElement