Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Functions

setData

  • setData(element: HTMLElement, selector: string, data: string | number | any[] | PlainObject | null): void
  • Can be used to set a HTML data- attribute to a certain element.

    Note: This is not jQuery! This will really set the attribute, no magical in-memory data here!

    Parameters

    • element: HTMLElement

      The element to set the data to

    • selector: string

      The name of the data attribute to set the value (data-)some-attribute. (The data- part is optional)

    • data: string | number | any[] | PlainObject | null

      The value to be set as data. Complex data will be json encoded. If NULL is given the data attribute will be removed

    Returns void

Generated using TypeDoc