Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface HTMLElement

Add methods for Dom object

Hierarchy

Index

Methods

attr

  • attr(key: string): string
  • attr(key: string, val: string): this
  • Parameters

    • key: string

    Returns string

  • Parameters

    • key: string
    • val: string

    Returns this

box

  • box(): { h: number; w: number; x: number; y: number }
  • Returns { h: number; w: number; x: number; y: number }

    • h: number
    • w: number
    • x: number
    • y: number

computedStyle

  • computedStyle(pseudo?: string): CSSStyleDeclaration
  • Returns the computed style of this element.

    Parameters

    • Optional pseudo: string

    Returns CSSStyleDeclaration

css

  • Gets the value of css name.

    Parameters

    • name: string

    Returns string

  • Sets the value of css name. Note:

    1. The val accepts !important declarations. So, the statement $1( "p" ).css( "color", "red !important" ) can be set to its css name.
    2. The val accepts offset value. Offset value is a string starting with += or -= to increment or decrement the current value. For example, if an element's padding-left was 10px, .css( "padding-left", "+=15" ) would result in a total padding-left of 25px.

    Parameters

    Returns this

  • Sets a set of css name-value pairs

    Parameters

    Returns this

empty

  • empty(): this
  • Removes ll children nodes and unbinds all their events binding with the on method.

    Returns this

find

findAll

  • Parameters

    • selector: string

    Returns NodeListOf<HTMLElement>

fire

  • fire(type: string): this
  • Parameters

    • type: string

    Returns this

off

  • off(type?: string, listener?: (this: HTMLElement, e: Event) => boolean | void, capture?: boolean): this
  • Parameters

    • Optional type: string
    • Optional listener: (this: HTMLElement, e: Event) => boolean | void
    • Optional capture: boolean

    Returns this

on

  • on(type: string, listener: (this: HTMLElement, e: Event) => boolean | void, useCapture?: boolean): this
  • on(type: string, listener: (this: HTMLElement, e: Event) => boolean | void, options?: { capture?: boolean; once?: boolean; passive?: boolean }): this
  • Parameters

    • type: string
    • listener: (this: HTMLElement, e: Event) => boolean | void
    • Optional useCapture: boolean

    Returns this

  • Parameters

    • type: string
    • listener: (this: HTMLElement, e: Event) => boolean | void
    • Optional options: { capture?: boolean; once?: boolean; passive?: boolean }
      • Optional capture?: boolean
      • Optional once?: boolean
      • Optional passive?: boolean

    Returns this

remove

  • remove(selector?: string): void
  • Removes self or all children nodes of special selector and unbinds all their events binding with the on method.

    Parameters

    • Optional selector: string

    Returns void

val

  • val(): string | string[]
  • val(v: string | string[]): this
  • Gets the selected or inputed values of form elements such as input, select and textarea. When called on a non-form element, it returns undefined. When the value of this element is an empty string, it returns ''.

    When this element is a select-multiple (i.e., a select element with the multiple attribute set), it returns an array containing the value of each selected option. If no options are selected, it returns an empty array.

    When this element is a checkbox, it returns the selected values of all same-name elements. When all checkboxes are not checked, it returns an empty array.

    When this element is a radio, it returns the selected value of all same-name elements. When all radio are not checked, it returns null.

    Returns string | string[]

  • Sets the form element's value such as input, select and textarea.

    When this element is a checkbox, it will select some same-name elements.

    When this element is a radio, it will select one same-name element.

    Parameters

    • v: string | string[]

    Returns this