Trilium Backend API
    Preparing search index...
    • For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

      Type Parameters

      Parameters

      Returns Cheerio<AnyNode>

      The closest nodes.

      $('.orange').closest();
      //=> []

      $('.orange').closest('.apple');
      // => []

      $('.orange').closest('li');
      //=> [<li class="orange">Orange</li>]

      $('.orange').closest('#fruits');
      //=> [<ul id="fruits"> ... </ul>]