如何使用 jQuery 选择表格列 [英] How to select a table column with jQuery

查看:16
本文介绍了如何使用 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+')')

这篇关于如何使用 jQuery 选择表格列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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