Let's say I have a div
mother, and within that div
I have other 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, when I clicked the button, the divs would change positions! Actually I would like the first div to be in the 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 itself!