Class Tooltip

Displays a tooltip that can contain images and formatting.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(element?: HTMLElement, options?: any): Tooltip

Creates a new Tooltip.

constructor

Parameters

  • element?: HTMLElement optional

    The DOM element associated that hosts the Tooltip.

  • options?: any optional

    An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the opened event, add a property named "onopened" to the options object and set its value to the event handler.

Returns

Tooltip

Properties

public contentElement: HTMLElement

Gets or sets the HTML element that is the content of the Tooltip.

public element: HTMLElement

Gets the DOM element that hosts the Tooltip control.

public extraClass: string

Gets or appends additional CSS classes to apply to the element that hosts the Tooltip.

public infotip: boolean

Gets or sets a value that specifies whether the Tooltip is an infotip, a tooltip that contains a lot of info and should be displayed for longer than a typical Tooltip.

public innerHTML: string

Gets or sets the HTML content of the Tooltip.

public placement: string

Gets or sets the position for the Tooltip relative to its target element: top, bottom, left or right.

Methods

public addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean)

Adds an event handler for the specified event.

Parameters

  • eventName: string

    The name of the event to handle.

  • eventHandler: Function

    The event handler function to associate with the event.

  • useCapture?: boolean optional

    Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase.

public close()

Hides the Tooltip.

public dispose()

Releases resources held by this Tooltip. Call this method when the Tooltip is no longer needed. After calling this method, the Tooltip becomes unusable.

public onbeforeclose(eventInfo: CustomEvent)

Raised just before the Tooltip is hidden.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public onbeforeopen(eventInfo: CustomEvent)

Raised just before the Tooltip appears.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public onclosed(eventInfo: CustomEvent)

Raised when the Tooltip is no longer displayed.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public onopened(eventInfo: CustomEvent)

Raised when the Tooltip is shown.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public open(type?: string)

Shows the Tooltip.

Parameters

  • type?: string optional

    A value that specifies when to show the Tooltip. The default value is "mousedown".

public removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean)

Removes an event handler that the addEventListener method registered.

Parameters

  • eventName: string

    The name of the event that the event handler is registered for.

  • eventCallback: Function

    The event handler function to remove.

  • useCapture?: boolean optional

    Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler.