JavaScript:如何迭代表格并删除Javascript中的第二个单元格 [英] JavaScript: How to iterate through a table and remove the second cell in Javascript

查看:104
本文介绍了JavaScript:如何迭代表格并删除Javascript中的第二个单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我有一张非常简单的表格:

Lets say that I have a very simple table:

<table>
   <tr>
      <td>TextFirst</td>
      <td>TextSecond</td>
   </tr>
</table>

如何遍历表格并移除TextSecond。该表可以是任意数量的行或单元。

How can I traverse the table and remove "TextSecond". The table could be any number of rows or cells.

推荐答案

$("table td:nth-child(2)").remove()

这篇关于JavaScript:如何迭代表格并删除Javascript中的第二个单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆