See the eq() and index() methods: http://docs.jquery.com/Selectors/eq#index http://docs.jquery.com/Core/index#subject
$('#xxx tr').each(function(){ var items = $(this).children(), title = items.eq(1).text(); items.each(function(){ $(this).find('a').attr('href', title + '_' + items.index ( this )); }); }); On Sep 5, 11:28 pm, din <dingl...@gmail.com> wrote: > <TR> > <TD>1</TD> > <TD>JM-53</TD> > <TD>--</TD> > <TD>--</TD> > <TD>--</TD> > <TD><A href="#">ROHs</A></TD></TR> > <TR> > <TD>2</TD> > <TD>JM-54</TD> > <TD><A href="#">ROHs</A></TD> > <TD>--</TD> > <TD>--</TD> > <TD><A href="#">ROHs</A></TD></TR> > > I want the value of "href" in first tag A is equal to "JM-53_5.htm". > And the the value of "href" in 2nd tag A is equal to "JM-54_2.htm". > The value of "href" in 3rd tag A is equal to "JM-54_5.htm". > HOW can I get the current Index of the tag A,and HOW TO get the value > of the current 2nd tag TD. > > MANY MANY THANKS~~~~