Skip to content

DomElementBuilder class


⊕ new DomElementBuilder(tag: string | TElement,parent?: HTMLElement): DomElementBuilder

  • tag: string | TElement
  • parent: HTMLElement, Optional


● element: TElement



▸ addChild(tag: "div",childBuilder?: (builder: DomElementBuilder<HTMLDivElement>) => void): this

  • tag: "div"
  • childBuilder: (builder: DomElementBuilder<HTMLDivElement>) => void, Optional

Returns this

▸ addChild(tag: "button",childBuilder?: (builder: DomElementBuilder<HTMLButtonElement>) => void): this

  • tag: "button"
  • childBuilder: (builder: DomElementBuilder<HTMLButtonElement>) => void, Optional

Returns this

▸ addChild(tag: "a",childBuilder?: (builder: DomElementBuilder<HTMLAnchorElement>) => void): this

  • tag: "a"
  • childBuilder: (builder: DomElementBuilder<HTMLAnchorElement>) => void, Optional

Returns this

▸ addChild(tag: "img",childBuilder?: (builder: DomElementBuilder<HTMLImageElement>) => void): this

  • tag: "img"
  • childBuilder: (builder: DomElementBuilder<HTMLImageElement>) => void, Optional

Returns this

▸ addChild(tag: "input",childBuilder?: (builder: DomInputElementBuilder) => void): this

Returns this

▸ addChild(tag: "select",childBuilder?: (builder: DomSelectElementBuilder) => void): this

Returns this

▸ addChild(tag: string,childBuilder?: (builder: DomElementBuilder<HTMLElement>) => void): this

  • tag: string
  • childBuilder: (builder: DomElementBuilder<HTMLElement>) => void, Optional

Returns this


▸ addChildElement(element: HTMLElement): this

  • element: HTMLElement

Returns this


▸ addClass(className: string,classNames: string[]): this

  • className: string
  • classNames: string[]

Returns this


▸ addHtml(html: string): this

  • html: string

Returns this


▸ addText(text: string): this

  • text: string

Returns this


▸ appendTo(parent: HTMLElement): this

  • parent: HTMLElement

Returns this


▸ attr(attrId: string,attrValue: string): this

  • attrId: string
  • attrValue: string

Returns this


▸ clear(): void

Returns void


▸ data(dataId: string,dataValue?: string): this

  • dataId: string
  • dataValue: string, Default value = null

Returns this


▸ hide(toHide?: boolean): this

  • toHide: boolean, Default value = true

Returns this


▸ html(html: string): this

  • html: string

Returns this


▸ id(value: string): this

  • value: string

Returns this


▸ isVisible(): boolean

Returns boolean


▸ off(eventType: string,listener: (event: Event, options?: boolean | AddEventListenerOptions) => any): this

  • eventType: string
  • listener: (event: Event, options?: boolean | AddEventListenerOptions) => any

Returns this


▸ on(eventType: string,listener: (event: Event, options?: boolean | AddEventListenerOptions) => any): this

  • eventType: string
  • listener: (event: Event, options?: boolean | AddEventListenerOptions) => any

Returns this


▸ removeClass(className: string,classNames: string[]): this

  • className: string
  • classNames: string[]

Returns this


▸ removeStyle(styleId: string): this

  • styleId: string

Returns this


▸ setStyle(styleId: string,styleValue: string): this

  • styleId: string
  • styleValue: string

Returns this


▸ show(): this

Returns this


▸ text(text: string): this

  • text: string

Returns this


▸ title(value: string): this

  • value: string

Returns this


▸ toDOM(): TElement

Returns TElement


▸ toggleClass(className: string,force?: boolean): this

  • className: string
  • force: boolean, Default value = undefined

Returns this


▸ visible(isVisible?: boolean): this

  • isVisible: boolean, Default value = true

Returns this