Brian's solution should work fine, except that clicking on the new row's button won't create another new row, because the event isn't being cloned along with the element. To clone events as well, use .clone(true) instead of .clone().

Also, if you're dealing with 100 or more rows, you might want to use event delegation instead. I wrote a blog entry about this a while back:

http://www.learningjquery.com/2008/03/working-with-events-part-1

The example uses an unordered list, but the same principle can be applied to table rows.

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Sep 10, 2008, at 10:14 AM, Brian Schilt wrote:


You can use the .clone() method to achieve this. When the button is
clicked, clone the last row of the table then change any specific IDs.

$('.button').click(function(){
 var newRow = $('table tbody tr:last').clone();
 $('table tbody').append(newRow);
});

Brian

On Sep 10, 7:29 am, Babu PCA <[EMAIL PROTECTED]> wrote:
Hi

I need a help

I have a table in which some 100 rows are there, each row contain a
button, when i click button i want to add a new row below this row
only how can i do this ?

can any one help me

Thanks

Reply via email to