2
Let’s say I have one div
Mom, and inside that div
I have another 3. And a Button.
<div id="mae">
<div id="a" class="child"></div>
<div id="b" class="child"></div>
<div id="c" class="child"></div>
</div>
<button id="Trocar">Trocar Div</div>
I would like then that when you click the button, the Divs change position! Indeed I would like the first div, to go last, and the next div to take the first position! And so on!
Ex :: Cliquei uma vez
<div id="mae">
<div id="b" class="child"></div>
<div id="c" class="child"></div>
<div id="a" class="child"></div>
</div>
Ex :: Cliquei duas vezes
<div id="mae">
<div id="c" class="child"></div>
<div id="a" class="child"></div>
<div id="b" class="child"></div>
</div>
Ex :: Cliquei três vezes
<div id="mae">
<div id="a" class="child"></div>
<div id="b" class="child"></div>
<div id="c" class="child"></div>
</div>
As you can see! The cycle repeats again!