I'm using javascript to covert an CSV file to HTML table, but I need to give any table column a diferent class, so I can use only the columns that I need.
I have no ideia how to use a dynamic class (instead of td.class) name for every colums the script create, anyone here knows any solution for that?
My code:
$.each(items, function(itemCount, item) {
tableHTML += '<td class="' + td.class + '">' + item + '</td>';
});
tableHTML += '</tr>';
Thanks!
classis a reserved word, you should useclassNameor just anything other than a reserved word. Your question is a bit confusing, are you trying to assign a class to each column?$tds.append( $('<td>').addClass(yourClassName).html(item));Then out of the loopYourTableRowElement.append($tds)