facetwp uncheck parent checkbox

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** uncheck the parent when checking a child checkbox **/
add_action( ‘wp_footer’, function() { ?>

<script>
(function($) {
$(document).on(‘click’, ‘.facetwp-depth .facetwp-checkbox’, function() {
if ( $( this ).hasClass( “checked” ) ) {
$(this).parent().prev().removeClass(‘checked’);
FWP.autoload();
};
});
})(jQuery);
</script>

<?php }, 100 );
{{/gist}}