tags:

views:

80

answers:

1

Hi,

I am using cloning method to clone a TR and append it to a table. The TR has a textbox and linkbutton(addmore). on click of this link button a new textbox should be shown along with the link button and current linkbutton should be hidden.

How to know that the addmore link is from last row/index. Is it possible to get to know Index if the row is cloned.

Need Help. TIA

Also other than :last and :first what are all the properties do we have? If the controls are produced dynamically how to find the last but not the one?

TIA.

+1  A: 
if($('.addMore').parent('tr').is(':last')) {
    alert('I am in the last row');
}

Assuming your add more links have a class of addMore.

karim79
I suspect that 'last' refers here to 'original' rather than 'final' - hopefully sagar can clear this up.
ozan
@ozan - Good point - I may have misunderstood. Let's see.
karim79
@ozan last refers to the final TR only . Its working fine.Do we have like :previous? or where to get to know about these properties. can you provide some useful uRL pls.
Okay, it wasn't clear to me. The docs for selectors are at http://docs.jquery.com/Selectors, but there is no :previous selector because it doesn't make sense to have one - previous relative to what? You will need to use the prev() method on the appropriate jquery object instead.
ozan