I have three unordered lists that have the same class. I loop through them and I'm trying to add items that match certain descriptions to each of them, but when I try to reference the list by its index, it says it can't find the append function. The code looks something like this:
demoTypes.upcomingDemos.map(function(item) {
var itemElement = "<li>My Item</li>";
if (demoTypes.type == "Basic") {
$(".unorderedListSection")[0].append(itemElement);
} else if (demoTypes.type == "Intermediate") {
$(".unorderedListSection")[1].append(itemElement);
} else if (demoTypes.type == "Advanced") {
$(".unorderedListSection")[2].append(itemElement);
}
});
Adding the items to ALL the lists seems to work fine for some reason (although I obviously don't want to do this):
$(".unorderedListSection").append(itemElement);