I need to create a table from an array recieved with an ajax call. I am creating a 4 column table and currently using…which works but looks awful and wrong. Is there a cleaner, easier to read way to write this?
$("div#ColorChart").append('<tr class="colorRow"><td class="colorIDCell" style="border:thin solid;width:100px">#'+val[0]+'</td><td class="symbolCell" style="border:thin solid;width:20px;text-align:center"><img src="images/symbols/'+val[2]+'.png" width="22" height="22" alt="#'+val[2]+'"/></td><td class="colorRGBCell" style="border:thin solid;width:20px" bgcolor="#'+val[1]+'"> </td><td class="colorNameCell">'+i+'</td></tr>'+"\n");
Looks good to me, but I suggest you use a separate css file to style your elements.
And also, when I add html with jquery I do something like this:
Hope I helped!