jQuery在<TR>TR折叠时标签不起作用
jQuery next in <TR> tag not working when TR collapse
我有一个有很多行的表,但每一行都需要一个帮助行,所以它们成对出现。
例如
<tbody>
<tr>
<td>Info 1</td>
<td>Info 2</td>
<td>Info 3</td>
<td>Info 4</td>
<td> <a>button more</a> </td>
</tr>
<!-- AND -->
<tr class="bottom-row">
<td colspan="2">Info 5</td>
<td colspan="2">Info 6</td>
<td>Info 7</td>
</tr>
<tr>
<td>OtherInfo 1</td>
<td>OtherInfo 2</td>
<td>OtherInfo 3</td>
<td>OtherInfo 4</td>
<td> <a>button more</a> </td>
</tr>
<!-- AND -->
<tr class="bottom-row">
<td colspan="2">OtherInfo 5</td>
<td colspan="2">OtherInfo 6</td>
<td>OtherInfo 7</td>
</tr>
我想点击显示的底部一行,然后再次点击以隐藏
我尝试使用jQuery UI 的切换
$(".btnMore").click(function(){
$(this).parent("td").parent("tr").next().toggle();
});
当底部的行可见时,此操作非常完美,当我添加style="display:none"
时,将停止工作。也尝试删除style="display:none"
并添加加载页面$(".bottom-row").hide();
,但都不起作用
我能做什么?
试试这个:
$('table').on("click", ".btnMore", function() {
$(this).closest('tr').next().toggle();
});
http://jsfiddle.net/PnUns/
当我尝试它时,它似乎工作得很好,http://jsfiddle.net/LF7Ar/1/
// I added the hide from the beginning
$(".btnMore").click(function(){
$(this).parent("td").parent("tr").next().toggle();
});
$('.bottom-row').hide();
相关文章:
- 在<页眉>标签
- Ckeditor-plugin:插入虚假元素add不情愿<p>标签前后
- iframe正在添加标签,需要删除它们
- 如何自动调整标签的高度以适应内容
- Jquery标签插件粘贴问题
- react-让一个元素返回两个相邻的<tr>标签
- jQuery在<TR>TR折叠时标签不起作用
- 如何在动态创建的tr标签表中添加合计
- 添加 tr 标签会导致函数停止工作
- 如何在TR的最后一个TD中添加事件或将ID属性添加到IMG标签
- Javascript(下拉函数)与TR标签
- 如何在<span>在<tr>具有不同行为的标签(onclick)
- 如何应用css样式的动态tr与td和输入标签
- CSS在标签最后的TR TD
- Regex从javascript的表中删除特定的tr标签
- 文档.在表、tr、td标签上创建元素在IE8上失败
- 我可以使用Jquery插入一个结束</tr>标签和开口<tr>标记在动态表中
- 检查动态表中td标签的数量,并将它们划分为两个相等的tr标签
- 如何在不复制值/数据的情况下克隆/复制 tr(tr 包含带有选择和输入标签的 td)
- ("id").val()对tr:subform标签不起作用