So I did some looking and couldn't find anything I needed or that would work for my situation.
I currently have a list that has 29 values and as it expands, it's going to get difficult and tiresome to add a table row for each value.
I have currently got the table all written out how I want it but would like to have some javascript do it on its own so all I have to do is add a new value to the list.
In the end, the complete table should look like this, http://hastebin.com/nesuyikiso.xml (that is what I have written out).
The list I will be working off is
var heroesName = ["Black Panther","Black Widow","Cable","Captain America","Colossus","Cyclops","Daredevil","Deadpool","Emma Frost","Gambit","Ghost Rider","Hawkeye","Hulk","Human Torch","Iron Man","Jean Grey","Loki","Luke Cage","Ms Marvel","Nightcrawler",/*"Nova",*/"Punisher","Rocket Raccoon","Scarlet Witch","Spider-Man","Squirrel Girl","Storm","Thing","Thor","Wolverine"];
I understand a for loop would be needed but I don't know enough about them to save my life. If someone could help me out it'd be much appreciated.
Thanks.
EDIT: I will accept jQuery as I am using it for other stuff on this page. Also, if someone could explain why this code won't work for what I want?
$.each(heroesName, function(index, value) {
$('tbody').append('<tr id="row' + index + '"></tr>');
$('tr#' + index).append('<td><input type="checkbox" id="active' + index + '"/><label for="active' + index + '" class="inline">Is Active?</label></td>);
$('tr#' + index).append('<td value="' + value + '">' + value + '</td>');
$('tr#' + index).append('<td><input type="text" maxlength="2" size="2"/></td>');
$('tr#' + index).append('<td><select id="select' + index + '"><option value="0">None</option><option value="1">Prestige 1</option><option value="2">Prestige 2</option><option value="3">Prestige 3</option><option value="4">Prestige 4</option><option value="5">Prestige 5</option></select></td>');
$('tr#' + index).append('<td> </td>');
});
label for=. In your firstcheckboxyou have it right, thefor=is connected to theidof theinput. The others don't match!'and"!