我有一个<table>
特定的<td>
包含<ul>
,当单击特定按钮时我想要它,会发生两件事:
- 包含 a
<tr>
的子项的父项被隐藏<td>
<ul>
- 执行步骤 1 后打印窗口,使
<tr>
包含<ul>
隐藏在打印的工作表上
http://jsfiddle.net/emturano/S9YWL/
HTML:
<table id="todo-list">
<tr>
<td>Entry No UL 1</td>
</tr>
<tr>
<td>Entry No UL 2</td>
</tr>
<tr>
<td>
<ul>I SHOULD BE HIDDEN WHEN PRINTED</ul>
</td>
</tr>
<tr>
<td>Entry No UL 4</td>
</tr>
</table><p>
点击打印
jQuery:
function () {
$('#followup_a').click(followup);
});
function followup() {
$('#todo-list tr:has(td:has(ul))').hide();
window.print();
}