Function select

  • Select the first element that matches the specified selector string. If no elements match the selector, returns an empty selection. If multiple elements match the selector, only the first matching element (in document order) will be selected.

    The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the datum, on the selected element. This is useful when re-selecting an element with a previously set, know datum type.

    Type Parameters

    Parameters

    • selector: string

      CSS selector string

    Returns Selection<GElement, OldDatum, HTMLElement, any>

  • Select the specified node element.

    The first generic "GElement" refers to the type of element to be selected. The second generic "OldDatum" refers to the type of the datum, on the selected element. This is useful when re-selecting an element with a previously set, know datum type.

    Type Parameters

    Parameters

    • node: GElement

      An element to be selected

    Returns Selection<GElement, OldDatum, null, undefined>