var newRowContent = "<tr><td>newcontent</td><td>newcontent2</td></tr>"; $("#test").click(function(){ $(newRowContent).appendTo($("#tblEntAttributes")); }); $("#test2").click(function(){ $(".table-hovor tbody").append(newRowContent); });
<table class="table table-hovor" id="tblEntAttributes"> <tbody> <tr> <td> first </td> <td> second </td> </tr> <tr> <td> third </td> <td> fourth </td> </tr> </tbody> </table> <button id="test">appendTo</button> <button id="test2">append</button>
#tblEntAttributes td{ padding: 5px; }