I have the following:
<div id='a'>
<div id='a1' />
<div id='a2' />
<div id='a3' />
<div id='a4' />
<div id='a5' />
</div>
Suppose that when a button is pressed I need to rearrange it like this:
<div id='a'>
<div id='a2' />
<div id='a4' />
<div id='a3' />
<div id='a1' />
<div id='a5' />
</div>
or something similar.
Now, I know how to get all the children from div a. I know how I can sort them (whatever my algorithm is)
The question is then what's the best way to rearrange them ?
I could remove them all. and then readd them one by one in the correct order.
That'd work but I think it would be wrong because of the reflow everytime a new item is added ?
can anybody help ? Point me to an article on the web or write down a solution
thanks