如何使用jQuery选择表列
问题描述:
我想选择一个表列,我所知道的只是列的标题文本。 (th.innerText)
I want to select a table column and all I know is the header text of the column. (th.innerText)
我尝试了以下代码,但它不起作用:
I tried the following code but it doesn't work:
ownerIndex = $('th:contains("Owner")').index();
$('table tr td:nth-child(ownerIndex)')
任何想法?
答
好的。我找到了一个解决方案:
Ok. I found a solution:
$('table tr td:nth-child('+ownerIndex+')')