I am looking for a more intuitive way to run the code below (as it is also incomplete to my purpose).
for (j = 0; j<items.length; j++) {
var indivItem = items[j];
if (indivItem.category == 1) {
$('.indiv_category[idnumber="1"]').append('<ul class="left_side_item"><li>'+indivItem.title+'</li></ul>');
}
else if (indivItem.category == 2) {
$('.indiv_category[idnumber="2"]').append('<ul class="left_side_item"><li>'+indivItem.title+'</li></ul>');
}
}
Essentially I need line 3 to check if (indivItem.category > 0)
then look for the element with a matching idnumber
attribute and append the necessary info.
I need this continue for the length of available .indiv_category
elements.
Basically a matchup of the all items in the 'items' array
to all of the elements with a matching 'idnumber' attribute to the item in the array that contains the same id number.