Calling a function in select event of Jquery autocomplete

I have some problem about coding of Jquery autocomplete. I tried to call a function (searchCategory) in the select event:

$(function() {
  $('#search').autocomplete({

    source: function(request, response) {
      let term = request.term;
      let data = handleAutocomplete(term); //your custom handling
      response(data);
    },
    minLength: 0,
    /**/
    select: function(event, ui) {

      if (ui.item) {
        console.log('select', ui.item.label);
        /*clicked(ui.item.value);*/
        searchCategory(ui.item.value);
        return ui.item.value;

      } else {
        console.log('select with null value');
      }
    },

but the function cannot be ran except the console log in beginning:

function searchCategory(value) {
  console.log(value);
  /*let itemLabel = value;*/
  let sSearch = value.toLowerCase().trim();
  console.log(sSearch);
  const records = $("#records > div");
  const result_card = $("#results > div");

  result_card.style.display = "none";