FacetWP – reset button within text widget

<?php

// Add the following to your (child) theme's functions.php
// Then use this for the button code within your widget:
// <button class="facetwp-reset-btn">Reset</button>

add_action( 'wp_footer', function() {
?>
<script>
    (function($) {
        $(document).on('click', '.facetwp-reset-btn', function() {
            FWP.reset();
        });
    })(jQuery);
</script>
<?php
}, 100 );