Trilium Backend API
    Preparing search index...
    • Method for getting and setting properties. Gets the property value for only the first element in the matched set.

      Type Parameters

      Parameters

      • this: Cheerio<T>
      • name: "tagName" | "nodeName"

        Name of the property.

      Returns string

      If value is specified the instance itself, otherwise the prop's value.

      $('input[type="checkbox"]').prop('checked');
      //=> false

      $('input[type="checkbox"]').prop('checked', true).val();
      //=> ok
    • Method for getting and setting properties. Gets the property value for only the first element in the matched set.

      Type Parameters

      Parameters

      • this: Cheerio<T>
      • name: "innerHTML" | "outerHTML" | "innerText" | "textContent"

        Name of the property.

      Returns string

      If value is specified the instance itself, otherwise the prop's value.

      $('input[type="checkbox"]').prop('checked');
      //=> false

      $('input[type="checkbox"]').prop('checked', true).val();
      //=> ok
    • Get a parsed CSS style object.

      Type Parameters

      Parameters

      • this: Cheerio<T>
      • name: "style"

        Name of the property.

      Returns StyleProp

      The style object, or undefined if the element has no style attribute.

    • Resolve href or src of supported elements. Requires the baseURI option to be set, and a global URL object to be part of the environment.

      Type Parameters

      Parameters

      • this: Cheerio<T>
      • name: "href" | "src"

        Name of the property.

      Returns string

      The resolved URL, or undefined if the element is not supported.

      $('<img src="image.png">').prop('src');
      //=> 'https://example.com/image.png'
    • Get a property of an element.

      Type Parameters

      Parameters

      • this: Cheerio<T>
      • name: K

        Name of the property.

      Returns Element[K]

      The property's value.

    • Set a property of an element.

      Type Parameters

      Parameters

      • this: Cheerio<T>
      • name: K

        Name of the property.

      • value:
            | Element[K]
            | (
                (
                    this: Element,
                    i: number,
                    prop: K,
                ) =>
                    | string
                    | number
                    | Document
                    | Element
                    | CDATA
                    | Text
                    | Comment
                    | ProcessingInstruction
                    | Record<string, string>
                    | ChildNode[]
                    | { [name: string]: string }
                    | TagSourceCodeLocation
                    | Attribute[]
                    | (<T extends Node>(this: T, recursive?: boolean) => T)
            )

        Value to set the property to.

      Returns Cheerio<T>

      The instance itself.

    • Set multiple properties of an element.

      Type Parameters

      Parameters

      Returns Cheerio<T>

      The instance itself.

      $('input[type="checkbox"]').prop({
      checked: true,
      disabled: false,
      });
    • Set a property of an element.

      Type Parameters

      Parameters

      • this: Cheerio<T>
      • name: string

        Name of the property.

      • value:
            | string
            | boolean
            | ((this: Element, i: number, prop: string) => string | boolean)

        Value to set the property to.

      Returns Cheerio<T>

      The instance itself.

    • Get a property of an element.

      Type Parameters

      Parameters

      • this: Cheerio<T>
      • name: string

        The property's name.

      Returns string

      The property's value.