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

116
Views
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 answers
Answer question

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 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!