Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
can't use appendChild on elements, only on body

I'm trying to create a function that will add rows and cells to a table with data from inputs, but for some reason after I create a new row and try to use appendChild (or just append) to put it in the table, the console shows an error:

"Uncaught TypeError: Cannot read properties of undefined (reading 'append')"

Thanks for helping!

<html>
 <body>
  <table id="tbl" border="1">
  <table>

  <script>
   function showStudent () {
        let tbl = document.getElementById('tbl')
        let tr = document.createElement('tr')
        document.tbl.append(tr)
      }
  </script>
 </body>
</html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try

tbl.append(tr)

Instead of

document.tbl.append(tr)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!