My HTML is:
var body = document.getElementsByTagName("body"); //to start building the table
document.getElementById("eobody").innerHTML = generate_table(paras1);
//runs the function that generates my table inside eobody
Looking at your JSFiddle, the
undefined is returned when you invoke the function.
generate_table() does all the injecting at the end:
tbl.appendChild(tblHead); document.getElementsByTagName("table").className = "tableizer-table"; tbl.appendChild(tblBody); body.appendChild(tbl);
there is no need for you to inject anything to the
div after invoking the function.
If you wanted to inject it in to your
div you could use it as the
appendChild() source element on the last line instead of