I am working on a web service with HTML, CSS and JavaScript. I have a list in a certain one with a fork where each item in the list is an image. In each of these images you can click.
The idea then is that you can click on each image and pass them to a new container.
HTML code with the image list:
<ul>
<li id="primerImagen">
<input type="image" src="pictures/primerImagen.png">
</li>
<li id="segundaImagen">
<input type="image" src="pictures/segundaImagen.png">
</li>
<li id="tercerImagen">
<input type="image" src="pictures/tercerImagen.png">
</li>
</ul>
In the following way, I achieve that the images appear in a new box
var contenedor = document.getElementById("tableBox2");
document.querySelectorAll('input[type="image"]').forEach(function(image) {
var imagenes = document.createElement("image");
image.addEventListener("click", function(e) {
contenedor.appendChild(this);
});
});
The problem is that I'm not making the images go from one place to another without removing them from the original list. Any suggestions on how to achieve this?