js 整理

来源:互联网 发布:sql 循环select结果集 编辑:程序博客网 时间:2024/05/21 13:21

1:多个div的排序


 var div = $('div').toArray().sort(function(a, b) {
            return parseInt($(a).attr("str")) - parseInt($(b).attr("str"))
        });
        $(div).appendTo($("#tabOrders").children().children().children());

<table>

<tbody>

<tr>

<td>

<div id="pnlPreviewBusinessCategory" str="1"></div>

<div id="pnlPreviewBusinessCategory" str="2"></div>

<div id="pnlPreviewBusinessCategory" str="3"></div>

<、td>

</tr>

</tbody>

<table>


2: 读取子项目应该使用 children()方法;读取父项目应该使用 parent()方法





原创粉丝点击