[英]How to hide last table's column from a javascript variable?
I want to hide the last column of table because its have action links which is no need to export in excel file..so how to hide last table's column from a JavaScript variable? 我想隐藏表格的最后一列,因为它具有操作链接,不需要在excel文件中导出。那么如何从JavaScript变量中隐藏表格的最后一列?
var table = $('#UserWorkRecdsTbl').html();
table = table.hide('th:last-child, td:last-child');
tab_text = tab_text + table;
Thanks in advance. 提前致谢。
You have to use hide()
on the selector with the targeted elements in the following way: 您必须通过以下方式将选择器上的
hide()
与目标元素一起使用:
$("#UserWorkRecdsTbl th:last-child, #UserWorkRecdsTbl td:last-child").hide();
td { text-align: center; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table id="UserWorkRecdsTbl" style="width:100%"> <tr> <th>Firstname</th> <th>Lastname</th> <th>Link</th> </tr> <tr> <td>Jill</td> <td>Smith</td> <td><a href="#">test</a></td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td><a href="#">test</a></td> </tr> <tr> <td>John</td> <td>Doe</td> <td><a href="#">test</a></td> </tr> </table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.