码迷,mamicode.com
首页 > Web开发 > 详细

jquery ui选中表格多行数据

时间:2015-03-30 11:18:34      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

<script src="../public/js/jquery-1.8.3.js"></script>
<script src="../public/js/jquery-ui-1.10.4.custom.js"></script>
<script src="../public/js/jquery-ui.js"></script>
<link rel="style/css" href="../public/css/jquery-ui.css" >
<title></title>
<style type="text/css">
td {
    border: 1px solid;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
    $("#fruits").selectable({                     //进行拖动多选
        filter:"tbody tr",                          //选择tbody下的tr进行多选
        stop:function(){                              //当拖动选择结束时,触发stop事件
            var result=$("#plate").empty().html($(this).find(".ui-selected").map(function(){
                return this.id; 
            }).get().join(","));
            }
        });
    });
</script>
</head>
<body>
    <table id="fruits" style="border-collapse:collapse;">
        <thead>
            <tr>
                <th>名称</th>
                <th>颜色</th>
                <th>味道</th>
            </tr>
        </thead>
        <tbody>
            <tr id="苹果">
                <td>苹果</td>
                <td>红色</td>
                <td></td>
            </tr>
            <tr id="橘子">
                <td>橘子</td>
                <td>橙色</td>
                <td></td>
            </tr>
            <tr id="猕猴桃">
                <td>猕猴桃</td>
                <td>褐色</td>
                <td></td>
            </tr>
            <tr id="葡萄">
                <td>葡萄</td>
                <td>紫色</td>
                <td></td>
            </tr>
        </tbody>
    </table>
    <div id="plate">多选的结果:</div>
</body>

jquery ui选中表格多行数据

标签:

原文地址:http://blog.csdn.net/colorsunlight/article/details/44747967

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!