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

168
Views
qué sucede con la variable cuando se agrega con apprendChild
<body> <h1 class="titulo">Esto es un <b style="visibility: none;">titulo</b> </h1> <div style="background-color: aliceblue; height: 200px;" class="container"></div> <div style="background-color: #ccc; height: 200px;" class="container1"></div> <script> /************** Create Elements ****************/ const container = document.querySelector(".container"); const container1 = document.querySelector(".container1"); const item = document.createElement("LI"); item.textContent = "this text go inside"; container.appendChild(item); container1.appendChild(item); console.log(item); </script>

Cuando se agrega el elemento variable a un elemento, no es posible agregarlo nuevamente a otro elemento.

Como muestro en el código, agrego la variable "elemento" al "contenedor" y luego agrego la misma variable "elemento" al "contenedor1" y desaparece del "contenedor".

¿Cómo puedo hacer para mantener el valor en la variable para agregarlo a muchos elementos?

Gracias

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!