jQuery 仅追加某些列
我的页面上有两个表格。第一个有三列,第二个有两列。第一个表的中间列是一个图像,当您单击它时,它将将该行向下移动到第二个表。目前我有
$('table td img.add').live('click', (function() {
$('table#tblName').append( $(this).closest('tr') );
}));
哪个有效。该行将从第一个表中删除并放置在第二个表的底部。唯一的问题是我只想移动第一列和第三列。我尝试在第二个表中添加一个中间列,然后使用 jQuery 在页面加载时隐藏它,但是当我追加一行时,该新行就有三个单元格。
I have two tables on my page. The first one has three columns and the second one has two. The middle column on the first table is an image that when you click on it, it will move that row down to the second table. At the moment I have
$('table td img.add').live('click', (function() {
$('table#tblName').append( $(this).closest('tr') );
}));
Which works. The row is removed from the first table and put at the bottom of the second. The only problem is that I want to only move the 1st and 3rd columns. I tried adding a middle column in the second table and then using jQuery to hide it when the page loaded, but as soon as I appended a row, that new row has three cells.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该有效。
this should work.