Uncaught TypeError: t.nodeName is undefined when clicking Search suggestion

Hey There. I am getting this error in console when I click on a search suggestion.

" Uncaught TypeError: t.nodeName is undefined"

Here is the page link:

The JavaScript code is as follows

$(’.eraseResults’).hide();

$(’#autocomplete, .autocomplete-results__dark-overlay’).on(‘click’, function () {

$(".search-suggestion-section").append($('.selectize-dropdown'));

});

function addClassSelectDropdown() {

$(".selectize-dropdown").addClass("hide  order-1 w100_nb");

}

function addClassProductsChild() {

$("#products").find("div").addClass("row p-0");

}

function notSpecial() {

$("span:contains('Not')").css("opacity", "0");

}

function bodyScroll() {

$('body').addClass("overflow-auto");

}

/*function showHelpLink() {

$('#helpLink').addClass("show", "opacity-1");

}*/

/* Hide Result */

$(".closeResults, .closeResultsBtn").click(function () {

$("#autocomplete-results, .closeResults, .selectize-dropdown, #mega-menu").removeClass("show");

$("#autocomplete-results, .closeResults, .autocomplete__placeholder, .selectize-dropdown").addClass("hide");

$('.autocomplete__placeholder').addClass("show");

$('.autocomplete__placeholder').removeClass("hide");

$('.top-specials-btn').removeClass();

$('.top-specials-btn').addClass();

$('body').removeClass('overflow-hidden');

$('body').addClass('overflow-auto');

$(".top-specials-btn, .top-evetech-logo, .navbar-toggle").addClass('opacity-1 can-click');

$(".top-specials-btn, .top-evetech-logo, .navbar-toggle").removeClass('opacity-30 cant-click');

$('#mega-menu').addClass('z-index-11');

$('#mega-menu').removeClass('z-index-10');

$('.top-specials-btn').addClass('opacity-1 can-click');

$('.top-specials-btn').removeClass('opacity-0 cant-click');

});

/* Reveal Result */

$("#autocomplete").click(function () {

$(".closeResults, .selectize-dropdown").addClass("show");

$("#autocomplete-results, .closeResults, .selectize-dropdown, #mega-menu").removeClass("hide");

$('.autocomplete__placeholder').removeClass("show");

$('.autocomplete__placeholder').addClass("hide");

$('body').addClass('overflow-hidden');

$('body').removeClass('overflow-auto');

$(".top-evetech-logo, .navbar-toggle").removeClass('opacity-1 can-click');

$(".top-evetech-logo, .navbar-toggle").addClass('opacity-30 cant-click');

$('#mega-menu').addClass('z-index-10');

$('#mega-menu').removeClass('z-index-11');

$('.top-specials-btn').addClass('opacity-0 cant-click');

$('.top-specials-btn').removeClass('opacity-1 can-click');

});

$(".query-link").click(function () {

$('#products').show();

});

const searchClient = algoliasearch(

'privare-id',

'private-password'

);

/* global $ instantsearch algoliasearch */

const autocomplete = instantsearch.connectors.connectAutocomplete(

({ indices, refine, widgetParams }, isFirstRendering) => {

    const { container } = widgetParams;

    if (isFirstRendering) {

        const optgroups = indices.map((index, idx) => ({

            $order: idx,

            id: index.index,

            name: index.index,

        }));

        container.html('<select id="ais-autocomplete"></select>');

        container.find('select').selectize({

            options: [],

            labelField: 'query',

            valueField: 'query',

            optgroupField: 'section',

            optgroupLabelField: 'query',

            optgroupValueField: 'id',

            highlight: false,

            onType() {

                $('.autoHideDefault').show();

                if (this.$control_input.val().trim().length > 0) {

                    $('#hideSearchTerm').val(this.$control_input.val());

                    $('.eraseResults').show();

                }

                else if (this.$control_input.val().trim().length == 0) {

                    $('.autoHideDefault').hide();

                    $('.eraseResults').hide();

                }

                refine(this.$control_input.val());

            }/*: refine*/,

            onBlur() {

                if (this.getValue().trim().length > 0 || $('#hideSearchTerm').val().trim().length == 0) {

                    refine(this.getValue());

                    search.helper.setQuery($(this).val().trim()).search();

                }

                else {

                    this.setTextboxValue($('#hideSearchTerm').val());

                }

            },

            onChange() {

                if (this.$control_input.val().trim().length > 0) {

                    $('.autoHideDefault').show();

                    $('.eraseResults').show();

                }

                else {

                    $('.autoHideDefault').hide();

                    $('.eraseResults').hide();

                }

                refine(this.$control_input.val());

            }/*: refine*/,

            score() {

                return function () {

                    return 1;

                };

            },

            render: {

                option: hit => `

                                <a class="query-link">

                                  <div class="query btn btn-info col-xs-12 rounded-8 btn-query">

                                      <div class="truncate">

                                        ${instantsearch.highlight({ attribute: 'query', hit })} <small>(${hit.eve_products.exact_nb_hits})</small>

                                      </div>

                                  </div>

                                <a>

                              `,

            },

            optgroups,

        });

        return;

    }

    const [select] = container.find('select');

    select.selectize.clearOptions();

    $('.totalCount').text("(" + indices[0].results.nbHits + ")");

    indices.forEach(index => {

        if (index.results) {

            index.results.hits.forEach(hit =>

                select.selectize.addOption(

                    Object.assign({}, hit, {

                        section: index.index,

                    })

                )

            );

        }

    });

    /*select.selectize.refreshOptions(select.selectize.isOpen);*/

}

);

const search = instantsearch({

indexName: 'eve_products',

searchClient,

});

search.addWidgets([

instantsearch.widgets.configure({

    hitsPerPage: 8,

}),

instantsearch.widgets.index({ indexName: 'eve_products_query_suggestions' }),

autocomplete({

    container: $('#autocomplete'),

}),

]);

search.addWidgets([

instantsearch.widgets.hits({

    container: '#products',

    templates: {

        item: document.getElementById('hit-template').innerHTML,

        empty: `<div class="col-xs-12 p-0">We didn't find any results for the search <em>"{{query}}"</em></div>`,

    },

})

]);

search.addWidgets([

instantsearch.widgets.stats({

    container: '#number-of-hits',

})

]);

search.addWidgets([

instantsearch.widgets.pagination({

    container: '#pagination',

})

]);

const renderStats = (renderOptions, isFirstRender) => {

const { nbHits } = renderOptions;

document.querySelector('#number-of-hits').innerHTML = `

                <span>${nbHits}</span>

              `;

};

search.start();

$(document).ready(function () {

$('.autoHideDefault').hide();

addClassSelectDropdown();

addClassProductsChild();

if ($('.selectize-dropdown-content').text === "") {

    $('.search-suggestion-section').css("min-height", "0");

}

else {

    $('.search-suggestion-section').css("min-height", "32px");

}

});

function showDefault() {

$('.autoHideDefault').show();

$('.eraseResults').show();

}

$(’.eraseResults’).click(function () {

$('#hideSearchTerm').val("");

$('.autoHideDefault').hide();

$('#ais-autocomplete-selectized').val("");

$('#ais-autocomplete-selectized').focus();

$('.eraseResults').hide();

$('.ais-Hits, .ais-Hits-list').addClass("col-xs-12 p-0");

});