Function buttonCreate

Creates a BUTTON element, wrapping it via button and returning it.

const b = buttonCreate(`Stop`, () => console.log(`Stop`));
someParent.addNode(b.el);
  • Parameters

    • title: string
    • OptionalonClick: (() => void)
        • (): void
        • Returns void

    Returns {
        set disabled(value: boolean);
        get el(): HTMLButtonElement;
        title: null | string;
        click(): void;
        dispose(deleteElement?: boolean): void;
        onClick(handler?: (() => void)): void;
    }

    • set disabled(value: boolean): void

      Sets disabled state of button

    • get el(): HTMLButtonElement

      Gets the button element

    • get title(): null | string

      Gets text content of button

    • set title(value: string): void

      Sets text content of button

    • click:function
      • Trigger onClick handler

        Returns void

    • dispose:function
      • Disposes the button. Removes event handler and optionally removes from document

        Parameters

        • deleteElement: boolean = false

        Returns void

    • onClick:function
      • Sets the click handler, overwriting existing.

        Parameters

        • Optionalhandler: (() => void)
            • (): void
            • Returns void

        Returns void