FacetWP – redirect on autocomplete selection

<script>
(function($) {
    $(document).on('facetwp-loaded', function() {
        if (1 === FWP.settings.pager.total_rows && 0 < FWP.facets['the_search'].length) {
            $('.facetwp-template a:first').click(); // click the first hyperlink
        }
    });
})(jQuery);
</script>