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

172
Vistas
what happens with the variable when appended with 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>

When appended the variable item to one element, It is not possible to append it again to another element.

As I show in the code, I append the "item" variable to the "container" and then append the same "item" variable to the "container1" and it dissapeared from the "container".

How can I do to maintain the value in the variable to append it to many elements?

Thanks

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