Click here to Skip to main content
15,908,775 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am creating table using JQuery inside my div (having id="chk"),
$("#chk").append("<table border=1 class='table table-striped'><thead><h3> Parameters </h3></thead><tr><th></th><th>Signal Name </th><th>Signal Description </th></tr>");

this is working fine. but
when I am trying to append one more row like,

$("chk").append("<tr><td>chkbox</td><td>Myname</td><td>Mydescription</td></tr>");

but its not appending.

is something missing. Please help me
thanks
tink.

What I have tried:

JavaScript
$("#chk").empty();

$("#chk").append("<table border=1 class='table table-striped'><thead><h3> Parameters </h3></thead><tr><th></th><th>Signal Name </th><th>Signal Description </th></tr>");

$("chk").append("<tr><td>chkbox</td><td>Myname</td><td>Mydescription</td></tr>");

$("#chk").append("</table>");
Posted
Updated 5-Jun-17 21:43pm

1 solution

append to tbody

$("#chk").empty();

      $("#chk").append("<table border=1 class='table table-striped'> <caption>     <h3> Parameters </h3> </caption> <thead>   <tr><th></th><th>Signal Name </th><th>Signal Description </th></tr> </thead> <tbody></tbody> </table>");

      $("#chk table tbody").append("<tr><td>chkbox</td><td>Myname</td><td>Mydescription</td></tr>");
 
Share this answer
 
Comments
Member 11859517 6-Jun-17 5:07am    
Hi Kartik,
Thanks for your response,
I tried your code, still it not working for me.
1st part is working fine but 2nd is not appending.
Karthik_Mahalingam 6-Jun-17 5:13am    
post your code in fiddle and share the link
Member 11859517 6-Jun-17 5:16am    
This is only code I have, I just want to add row in table.
Karthik_Mahalingam 6-Jun-17 5:14am    
https://jsfiddle.net/mbbhkm98/
Member 11859517 6-Jun-17 5:24am    
cool, It's working, I have to check with my code where I am missing something,
Thanks Karthi ji,

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