Jquery append add html?


Hi Im trying to add above tbody or a table some content but for some reason doesn’t work when I add html however works on only with text…

$('table').find('tbody').before( \"<tr><td><div>hhhh</div></td></tr>\" );");

Doesn’t work
$('table').find('tbody').before( \"<tr><td><div style=\"color:red;\">hhhh</div></td></tr>\" );");


Hi @letsforum, actually neither line should work as the escape character outside the string is a syntax error, and there’s an excess closing paren + semicolon at the end of each. If you fixed that both lines should work as intended though.