How to quickly get jQuery selector for text fields in the first 5 rows of a table? I have a table with many rows and many text fields; I'm just trying to select text fields in the first 5 rows of a table. Is there an easy way to do this?
Use lt ()
$('tr:lt(5) input[type=text]')
Note that this is lt (5), not lt (6), since indexes are based on 0.
to try:
$("#yourTable tr:lt(5) input[type=text]")
see " http://docs.jquery.com/Selectors/nthChild#index "
try width:
$("table tbody tr:nth-child(0)").html(); $("table tbody tr:nth-child(1)").html(); $("table tbody tr:nth-child(2)").html(); $("table tbody tr:nth-child(3)").html(); $("table tbody tr:nth-child(4)").html();