$(function() { var takeHtml = $('#take').html(); alert(takeHtml); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <thead> <tr> <th>Zag1</th> <th>Zag1</th> <th>Zag1</th> <th>Zag1</th> </tr> </thead> <tbody> <tr> <td>QWER</td> <td>QWER</td> <td>QWER</td> <td>QWER</td> </tr> <tr id="take"> <td>QWER1</td> <td>QWER1</td> <td>QWER1</td> <td>QWER1</td> </tr> </tbody> </table> As in the takeHtml variable , put HTML not only, which is in the block, but also the code of the block itself. Those. the result should not be like this:
<td>QWER1</td> <td>QWER1</td> <td>QWER1</td> <td>QWER1</td> And this:
<tr id="take"> <td>QWER1</td> <td>QWER1</td> <td>QWER1</td> <td>QWER1</td> </tr> The option with "" + takeHtml + "" not desirable, because tr may contain a bunch of other selectors.