+ 3
Why table object rows , deleteRow() etc. Not working?
Why these objects are not working in sololearn?
1 Réponse
+ 4
Jay,
This post has the answer to your question. Basically, the DOM is not yet completely structured when the table element was queried
https://www.sololearn.com/post/90825/?ref=app
Adding the code into the load event handler is one viable option
window.onload = () =>
{
const tbl = document.getElementById("myTable");
try
{
console.log("Table rows: ", tbl.rows.length);
}
catch (err )
{
console.log(err);
}
}