I have a bunch of floating divs in a box arranged as follows:
The HTML is simple, and looks something like this:
<div class="square">0</div>
<div class="square">1</div>
<div class="square">2</div>
Each box has events and other properties on it, and I am having trouble swapping two divs with each other (e.g. 7 and 8, or 1 and 4, etc). I have tried an approach like this (where id1 and id2 are the indexes of the two divs being swapped):
var temp = box.children[id1];
area.children[id1] = box.children[id2];
area.children[id2] = temp;
But this yields no results. Any help would be appreciated!