Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Child terms unticked by default › Reply To: Child terms unticked by default
July 19, 2022 at 2:41 pm
#38487
Keymaster
You are welcome. That should not be too difficult, try this instead of the previous version:
jQuery(function($){
$('*[data-lvl]').removeAttr('data-lvl');
$(".asp_option_cat_level-1").hide();
$(".asp_option_cat_level-2").hide();
$(".asp_option_cat_level-0").click(function(){
var $next = $(this).next(), checked = $(this).find('input[type=checkbox]').prop('checked');
while ( $next.hasClass('asp_option_cat_level-1') || $next.hasClass('asp_option_cat_level-2') ) {
if ( $next.hasClass('asp_option_cat_level-1') ) {
$next.toggle();
} else {
$next.hide();
}
if ( !checked ) {
$next.find('input[type=checkbox]').prop('checked', false);
}
$next = $next.next();
}
});
$(".asp_option_cat_level-1").click(function(){
var $next = $(this).next(), checked = $(this).find('input[type=checkbox]').prop('checked');
while ( $next.hasClass('asp_option_cat_level-2') ) {
$next.toggle();
if ( !checked ) {
$next.find('input[type=checkbox]').prop('checked', false);
}
$next = $next.next();
}
});
});