jquery ui选中表格多行数据

<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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值