Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Functions

getData

  • getData(element: HTMLElement, selector?: string, fallback?: any): any
  • This helper receives a html element and extracts either a single, or all data attributes from it. It can also accept a default, which is returned if the given element has no data with the required selector

    Parameters

    • element: HTMLElement

      The html element to get the data from

    • Optional selector: string

      Optionally, the name of the data attribute to read from (data-)some-attribute. (The data- part is optional)

    • Optional fallback: any

      Optional value which will be returned if the data attribute for the selector was not found

    Returns any

Generated using TypeDoc