【问题标题】:Finding specific table head using jQuery使用 jQuery 查找特定的表头
【发布时间】:2012-05-27 21:27:48
【问题描述】:

jQuery 中是否有一种方法可以跨多个表头类进行计数 (<th class="entity7">Machine Names</th> 标签)直到找到一个值为“Machine Names”的表头? “机器名称”是我需要计算的特定表头单元格中的值。这将让我知道我想使用哪个数字列。

【问题讨论】:

    标签: jquery class html-table head


    【解决方案1】:

    您可以为此使用filter()

    var $th = $("#myTable th").filter(function() {
        return $(this).text() == "Machine Names";
    });
    var columnNumber = $th.index();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-17
      • 2017-01-21
      • 1970-01-01
      相关资源
      最近更新 更多