【问题标题】:How to select the first <td>s on the left of <table> with jQuery?如何使用jQuery选择<table>左侧的第一个<td>?
【发布时间】:2011-04-09 00:19:10
【问题描述】:

如何用jQuery选择第一列的tds?

【问题讨论】:

    标签: jquery html html-table jquery-selectors


    【解决方案1】:

    给定这样的 HTML:

    ​<table>
      <tr><td/><td/></tr>
      <tr><td/><td/></tr>
    </table>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
    

    例如,您可以使用此 jQuery 设置每行中每个第一个 td 的文本:

    $("table tr td:first-child").text("hello");​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-24
      • 2012-03-15
      • 2018-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-03
      • 2015-08-02
      相关资源
      最近更新 更多