jqueryselector

How to get text from the first column in a table?


There is a table in a webpage (in my case, http://developer.chrome.com/extensions/api_index) and I want to obtain all the method names in Stable APIs. So I want to get an array, the elements of which are the things in the first column.

How to do it?

$("table:eq(5) tr td:eq(0)")

this code does not work, because it does not get text from all the first td elements in all rows, but only in one row. What to do?


Solution

  • You can use the :first-child selector (http://www.w3schools.com/cssref/sel_firstchild.asp), it'll select the first table cell for each row.