Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
i have on table with 3 rows and 3 columns .so i want to inert one more row in the middle of the rows in the table when button was clicked using java script.so please provide solution to this
Posted

I won't give you the solution, but I will give you some terms to search for: appendChild and createElement.

With these you should be able to find a solution yourself.
 
Share this answer
 
Comments
venkataramreddy 7-Jun-11 15:12pm    
thanks mark
i tried with these two. i am able to create a new row in the bottom of the table but not in the middle of the table
[no name] 7-Jun-11 19:09pm    
Not trying to be difficult here, but seriously, you have enough information to figure this out. Giving you the answer will not teach you anything.
Sergey Alexandrovich Kryukov 7-Jun-11 15:14pm    
Right way to answer, my 5.
--SA
RakeshMeena 8-Jun-11 5:59am    
5 from my side as well!!
This is what you can try with JQuery:
To insert fixed format after some row (say 1st):
$("#tbl tr:nth-child(1)").after('<tr><td></td><td></td><td></td></tr>');


To insert a copy of some row (say2nd) after some row (say 1st):
$("#tbl tr:nth-child(1)").after($("#tbl tr:nth-child(2)").clone());


Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900