我有很多行的表,但各行需要幫助排,所以它們是成對出現的。jQuery的未來在<TR>標籤不工作時,TR崩潰
例如
<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();
但不起作用要麼
我可以做什麼?
隱藏的行不應該改變不是它是其他的功能首先隱藏。你確定添加這種風格沒有導致無效的HTML由於錯字? –
我看到一類btnMore的任何元素,你的'$(「 btnMore」)'選擇在你的例子匹配。 – j08691
創建jsfiddle.net是複製problem.Nothing在你的代碼演示顯示'顯示:none' – charlietfl