(function($) {
FWP.hooks.addAction('facetwp/loaded', function() {
var facet_name = 'search'; // EDIT ME
var allowed_elements = '.cat-item__title a, .cat-item__descr p'; // EDIT ME
var keywords = FWP.facets[facet_name].toString();
if ('' !== keywords) {
$(allowed_elements).each(function() {
var results = $(this).html();
results = results.replace(new RegExp(keywords, "gi"), (match) => `<mark>${match}</mark>`);
$(this).html(results);
});
}
});
})(jQuery);