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

156
Views
[HTMLDivElement].appendChild([HTMLDivElement]) devolviendo TypeError

Estoy tratando de agregar un elemento div a otro elemento div con JS, pero arroja un error:

 let SynthVoice = class { constructor(name){ this.synthPanel = document.createElement("div"); this.synthContainer = document.getElementById("synthChannels"); // div element this.synthPanel.id = name; // "synth0" this.synthContainer.appendChild(this.synthPanel); } }
 <!DOCTYPE html> <html lang="en"> <head> <script src="/synth/overhaul.js"></script> <link rel="stylesheet" href="/synth/styles.css" /> </head> <body> <button id="createSynth" onclick="synth0 = new SynthVoice('synth0')">Create Synth 0</button> <div id="synthChannels"></div> </body> </html>
 #synthChannels { display: flex; }

TypeError: no se pudo ejecutar 'appendChild' en 'Nodo': el parámetro 1 no es del tipo 'Nodo'.

Todo el código que se muestra está en el constructor de la clase SynthVoice , de la cual se crea una nueva instancia con solo hacer clic en un botón. Otras respuestas en StackOverflow y MDN dicen que este código debería funcionar, pero no funciona, ¡ayuda!

Editar: se agregó un código adicional para que el error pueda (con suerte) reproducirse más fácilmente

about 4 years ago · Juan Pablo Isaza
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!