Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
I got = TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'

I have been reading similar questions, but the most common problem is selecting a string, which is not my case.

const container = document.querySelector(".container")
const towerOne = document.querySelector("#towerOne")
const discs = document.querySelectorAll(".disc")

let chosen

discs.forEach(choices => choice.addEventListener("click", (e) => {
    chosen = e.target.id
    towerOne.removeChild(chosen)
    container.appendChild(chosen)
}))

I've tried declaring let chosen as " " before but changing it modified anything.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

chosen is the id attribute of an element. You'll want to get the target of the event instead:

const container = document.querySelector(".container")
const towerOne = document.querySelector("#towerOne")
const discs = document.querySelectorAll(".disc")

let chosen

discs.forEach(choices => choice.addEventListener("click", (e) => {
    chosen = e.target
    towerOne.removeChild(chosen)
    container.appendChild(chosen)
}))
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda