appending to non existance selector
hey guys im trying to create a selector in a foreach loop and append to it further down in my code
what is the best way to achive this please?
- $.each(data, function(category, stuff) {
$("#categories").append('<li id="category_'+ category +'">' + category + '</li>');
$.each(stuff, function(sub_category, items){
// $('category_' + category).append('<li id="sub_category_'+ sub_category +'">' + sub_category + '</li>'); // here is the error.
});
});
thank you