Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
182 views
in Technique[技术] by (71.8m points)

javascript - How to get table cell at specified index using jQuery

I know that I can get first or last table cell (e.g. for last row) using jQuery expression like below:

first cell: $('#table tr:last td:first') or last cell: $('#table tr:last td:last')

But, how can I get cell at specific index, for example index 2, using similar expression, i.e. something like $('#table tr:last td:[2]') ?

Regards.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes:

$('#table tr:last td:eq(1)')

that will give you the second td in the last row.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...