Add a custom class to each catmenu li based off category name

$("#catnav li").each(function(){
    className = $(this).find("a").text();
    className = className.split(' ').join('-');
    $(this).addClass(className);
});

Index Previous Next