So if you just use
another approach is to use a string passed to the jquery selector:
var lis = $('#' + id).find('.' + cat);
replace it with
var $lis = $('#' + id + ' ul .' + cat);
Some while ago i had the same problem in desktop development and the approach above helped me.
var selector = '#' + id + ' ul .' + cat; // the selector is constructed first
var lis = $(selector); // and than is passed to the jquery to obtain the desired info.