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 12:28 pm
#38481
Keymaster
Hi,
Something like this:
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();
console.log(this, $next);
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();
}
$next = $next.next();
}
});
$(".asp_option_cat_level-1").click(function(){
var $next = $(this).next();
while ( $next.hasClass('asp_option_cat_level-2') ) {
$next.toggle();
$next = $next.next();
}
});
});