You can edit your function a little, it will work on each <ul>offline mode:
$('.facet ul').each(function() {
if($(this).children('li:gt(9)').hide().length === 0) return;
$(this).append(
$('<li id="toggler">More</li>').toggle(function() {
$(this).text('Hide').siblings().show();
}, function() {
$(this).text('More').siblings('li:gt(9)').hide();
}));
});
See a working demo here
Before that, he received any limore than 9, you want to make this for <ul> an element with .each(), as in the example above.
source
share