vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.15k stars 1.38k forks source link

How can I highlight the matched substring in the search result? #2533

Closed ivan-ilinov closed 3 years ago

ivan-ilinov commented 3 years ago

Like I am a search <strong>res</strong>ult. res is my search key.

ivan-ilinov commented 3 years ago
  $tree.on('search.jstree', function (event, data) {
    $.each(data.res, function (index, value) {
      $('#' + value + '_anchor').highlight(data.str);
    });
  });