Create table inside cell

Asked

Viewed 52 times

0

Hello. I have a script where I need to add a new table in a td created via javascript. I tried to create the new table directly using something like:

var newTable = cell3_prod.createElement("TABLE");

I thought it would work but caused error I tried that way too:

cell3_prod.appendChild(document.createElement("TABLE"));
var tab_produto = cell3_prod.getElementsByTagName("TABLE");

It hasn’t worked yet. This should work or depend on something else?

1 answer

1

I changed the code to

var tab_produto = document.createElement("TABLE");
cell3_prod.appendChild(tab_produto);

and it worked.

Falow!! Thanks a lot!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.