Can i use native javascript for loop within jquery code? I have a construct in which $.each does not seem feasible. How can I loop in this situation?
the code inside the for loop is not working. any advice would be appreciated.
if (item.relate){
$(prodHeading).append(item.name);
if (item.image) {$(prodContent).append(item.image);}
if (item.description) {
$(prodContentText).append(item.description);
$(prodContent).append(prodContentText);
}
$(prodBox).append(prodHeading);
$(prodBox).append(prodContent);
//going to look for other attached items
for (j=0; j<10; j++){
var prodBox = $(document.createElement('div')).attr('class','productBox');
var prodHeading = $(document.createElement('div')).attr('class','productBoxHeading');
var prodContent = $(document.createElement('div')).attr('class','productBoxContent');
var prodContentText = $(document.createElement('div')).attr('class','text');
if ('item.image'+j) {$(prodContent).append(item.image);}
if ('item.description'+j) {
$(prodContentText).append(item.description);
$(prodContent).append(prodContentText);
}
$(prodBox).append(prodHeading);
$(prodBox).append(prodContent);
}
}