Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
im having checkboxlist in my webpage and i created an html table in .aspx page now i want to add rows when an item in checkboxlist is checked. Help Me,Thank you
Posted
Comments
[no name] 1-Aug-14 1:43am    
http://www.codeproject.com/Questions/802685/adding-rows-dynamically-to-an-html-table-using-Jav
Adding the same question again is not a good habit
Member 10924493 1-Aug-14 2:23am    
i want solution in javascript or Jquery so that i asked and im new to this website

1 solution

You can try the append method in jquery . See the example here

XML
$("#dynamicTable").append("<table id='dynatab' class='dynatab'><tr><td class='firsttd'>Agency</td><td class='firsttd'>UserName</td><td class='firsttd'>ID</td></tr></table>");

            employees = [
            { "Agency": "Cronus", "Username": "Sibi", "ID": "1" },
            { "Agency": "VSNB", "Username": "Vetri", "ID": "2" },
            { "Agency": "IIC", "Username": "Kamatchirajan", "ID": "3"}];


            for (var i = 0; i < employees.length; i++) {
                $(".dynatab").append("<tr class='dynaTR'><td>" + employees[i].Agency + "</td><td>" + employees[i].Username + "</td><td>" + employees[i].ID + "</td></tr></table>");
            }
 
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