I have the following HTML structure:
<div id="container">
<div>1</div>
<div class="red">2</div>
<div class="red">3</div>
<div>4</div>
<div>5</div>
<div class="red">6</div>
<div>7</div>
</div>
I wast to run some Jquery that will sort the divs inside the div container by ordering the divs first that have class="red", and then those that don't, so the final structure should be:
<div id="container">
<div class="red">2</div>
<div class="red">3</div>
<div class="red">6</div>
<div>1</div>
<div>4</div>
<div>5</div>
<div>7</div>
</div>
Help? Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…