<script language="javascript" src="jquery-1.4.4.min.js"></script> <script> $(function(){ var arr = new Array("4","3","2","1","9","8","7","6","5"); for (var i = 0; i < 9; i++) { var hh = $("#"+arr[i]); $("#"+arr[i]).remove(); $("#ha").append(hh); } }); </script>
<div id="ha"></div> <div class="test1" id="1">1111sdfsdf</div> <div class="test1" id="2">2222sdfsd</div> <div class="test1" id="3">333fsdf</div> <div class="test1" id="4">4444sdf</div> <div class="test1" id="5">5555sdfsd</div> <div class="test1" id="6">6666fsdfs</div> <div class="test1" id="7">7777s</div> <div class="test1" id="8">8888dfsd</div> <div class="test1" id="9">9999fsd</div>