I have the following:
<asp:panel id="myASPPanel" runat="server"... />
There are some dynamically created tables in the codebehind. Let's say there are 3 tables and we only want to get 1 of them, the first one. We are trying to do this using Javascript.
We have a function that RECEIVES the 'myDiv' ID.
We are then able to get the number of tables and iterate through them. However, when we get Table1, we only get the CONTENTS INSIDE the table, not the tags/html/attributes, etc.
Let's say this is the table:
We are only able to get "MyTD", NOT the entire table. We want to store the entire table, along with its tags (just as it has been typed above) and display it.
We noticed that myDiv.getElementsByTagName('table').length works (for determining the number of tables inside of the DIV), but when we want to store the entire table in a variable, we do this: myDiv.getElementsByTagName('table')[i].innerHTML (this only gives us the 'MyTD' text, not tags, not HTML, not entire table element and its attributes) and if we use this: myDiv.getElementsByTagName('table')[i], what shows on the screen is [object HTMLTableElement]
How can we get the entire table along with its HTML, attributes, in-line style, etc?
Thank you.
What I have tried:
myDiv.getElementsByTagName('table')[i].innerHTML
myDiv.getElementsByTagName('table')[i]