Why table object rows , deleteRow() etc. Not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why table object rows , deleteRow() etc. Not working?

Why these objects are not working in sololearn?

24th Sep 2021, 7:59 AM
Jp (Jay )
Jp (Jay ) - avatar
1 Answer
+ 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); } }
24th Sep 2021, 8:18 AM
Ipang