fselect modify label html

add_action( 'wp_head', function() {
    ?>
    <script>
    document.addEventListener('DOMContentLoaded', function () {
        if ( 'undefined' !== typeof FWP && 'undefined' !== typeof FWP.hooks) {
            FWP.hooks.addFilter('facetwp/set_options/fselect', function(opts, facet) {
                if (facet.facet_name == 'categories') {
                    opts.optionFormatter = function(label, node) {
                        var counter = node.getAttribute('data-counter');
                        return (counter) ? label + ' <span class="my-class">' + counter + '</span>' : label;
                    };
                    return opts;
                }
            });
        }
    });
    </script>
    <?php
}, 100);