views:

100

answers:

3

I want to add the tbody below:

<tbody id="contact">
    ...
</tbody>

to a specified table:

<table id="target">
...
</table>
A: 

Ripped off the jQuery docs, you can use

$("p").append("<strong>Hello</strong>");

So in your case it'll be

$('#target').append("<tbody id=\"contact\">...</tbody>");
Sudhir Jonathan
Almost, the double quotes within double quotes will throw the JavaScript engine off.
David Andres
and make sure you escape the quotes... i forgot :-/
Sudhir Jonathan
lol... David and me are editing this almost simultaneously :D
Sudhir Jonathan
Yes, we are. Got to be a really fast typist to get these answers done quickly.
David Andres
Edit the answer with the corrected code.
rahul
A: 
var tbody = "<tbody id='contact' />";

$("#target").append(tbody);
David Andres
A: 
$("#target").append("<tbody id='contact'>content</tbody>");

Read

append

rahul