开发者

How I pick all elements of a table cell by index using jQuery?

开发者 https://www.devze.com 2023-03-02 21:29 出处:网络
I need all the elements of the 开发者_Go百科cells using jQuery. Let us assume I have three columns and if I give second column index then response should be only from second column.

I need all the elements of the 开发者_Go百科cells using jQuery.

Let us assume I have three columns and if I give second column index then response should be only from second column.

Thanks in advance


Use this:

$("#table1").find("tr td:nth-child(3)")

This will give you all the td elements from the 3rd column (change the '3' for your value)

Cheers


Loop through each row and push the .text() from the td at the index you are looking for into an array.

See http://jsfiddle.net/derekddecker/YWX9F/

0

精彩评论

暂无评论...
验证码 换一张
取 消