Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
jQuery中是否有一种方法可以计算多个表头类(<th class="entity7">Machine Names</th>标签),直到找到值为“机器名称”的表头?“机器名称”是我需要计算的特定表头单元格中的值。这将使我知道我想使用哪个数字列。
<th class="entity7">Machine Names</th>
您可以filter()为此使用:
filter()
var $th = $("#myTable th").filter(function() { return $(this).text() == "Machine Names"; }); var columnNumber = $th.index();