Disable parents with children in fselect

<?php
add_action( 'facetwp_scripts', function() { ?>
    <script>
    (function($) {
        FWP.hooks.addAction('facetwp/loaded', function() {
            $( '.facetwp-facet-my_categories .fs-option.d1').each(function() {
                var el = $(this);
                var parent = el.prev('.fs-option.d0');
                parent.addClass( 'disabled' );
            });
        }, 100 );
    })(jQuery);
    </script>
<?php }, 100 );