I have 3 divs each with an ID id the first div does not contain anything and the other two a name and an image I am dealing with a function that when they pass 10 seconds move the div that is in second place to the first one and that each one changes color but I only manage to change the color I can not position the last one to the first bone replacing the first div that is empty by the third div that is to say the last the idea is that I change position I do not know if I understand here I leave the code
function cambiarPorOtro() {
//ejecutará la función siguiente a los diez segundos:
setTimeout("cambiarPorOtro2()",10000);
}
function cambiarPorOtro2() {
first.innerHTML = capaVideo2.innerHTML;
document.getElementById("capaVideo2").style.background="green" ;
document.getElementById("capaVideo").style.background="grey" ;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="first"></div>
<a href="javascript:cambiarPorOtro2();">click para colocar a andy en primer lugar </a>
<div id="capaVideo" style="display:block; background:yellow; ">henrry<img src="avatar.png" width="60px" height="60px"></div>
<div id="capaVideo2" style="display:block; background:yellow; ">Andy<img src="avatar.png" width="60px" height="60px"></div>