Javascript jQuery下一步在<;TR>;TR崩溃时标签不工作
我有一张有很多行的桌子,但每一行都需要一个帮助行,所以它们成对出现 比如说Javascript jQuery下一步在<;TR>;TR崩溃时标签不工作,javascript,jquery,html,Javascript,Jquery,Html,我有一张有很多行的桌子,但每一行都需要一个帮助行,所以它们成对出现 比如说 <tbody> <tr> <td>Info 1</td> <td>Info 2</td> <td>Info 3</td> <td>Info 4</td> <td> <a>button more</a> </td> </t
<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>
当底部的行可见时,当我添加style=“display:none”
时,此功能将完美运行。还可以尝试删除style=“display:none”
和加载页$(“.bottom row”).hide()代码>但也不起作用
我能做到吗?试试这个:
$('table').on("click", ".btnMore", function() {
$(this).closest('tr').next().toggle();
});
当我尝试时,它似乎很好用
隐藏行不应该改变功能,除非它先被隐藏。您确定添加该样式不会因为输入错误而导致无效html吗?我在示例中没有看到任何元素具有与您的$(“.btnMore”)
选择器相匹配的btnMore类。请在jsfiddle.net中创建一个复制问题的演示。您的代码中没有任何内容显示display:none
工作正常:非常感谢您的支持,但是,这两个答案都不适用于我,就像我的问题是css,但我不能修改enterpress rulez。任何mod都可以关闭此问题。非常感谢您的支持,但是,这两个答案对我都不适用,就像我的问题是css,但我不能为enterpress rulez修改。任何国防部都可以解决这个问题。
$('table').on("click", ".btnMore", function() {
$(this).closest('tr').next().toggle();
});
// I added the hide from the beginning
$(".btnMore").click(function(){
$(this).parent("td").parent("tr").next().toggle();
});
$('.bottom-row').hide();