Given this nth row in a table, can jquery add only the markup to close the table
<tr class="eop">
<td> 8/31 </td>
<td> XYZ </td>
<td> 2 </td>
<td> 92.00 </td>
</tr>
</tbody> --
</table> |
<table> -- // inserted markup
head jquery var |
<tbody> --
What I'm trying is to use:
$('tr.eop').append("</tbody></table><table>+head+<tbody>"); // head = table header
Please try this. See if it works.
The DOM consists of element nodes, the opening and closing tags mean nothing once an element is part of the DOM or a DOM Fragment.
You cannot attach elements to the page that do not have a closing tag. If the closing tag is omitted, one will be created for you. You also cannot close a parent element by appending a closing tag as a child, it will instead simply create a new complete element inside the parent element.
If you want to create a new table, create a new table.
If not a good practice, however it works (I'm not sure if it can fail at some point), take a look to this example:
http://jsfiddle.net/MKSqy/
However I'm not sure what you're trying to accomplish, you can easily do something similar by manipulating the DOM tree. Or changing the way you are building the app, instead of using tables use divs and create a hidden or that is shown when you want.
and manipulate the css to create a table style. I recommend this just for just case, however table tag exist for a reason and you shouldnt abuse of divs.
EDIT: I didnt understand very well so this is what you need
http://jsfiddle.net/MKSqy/1/
What this does is basically select the next elements after the nth element and create a table and append it right next to the preovious table. So you dont have to handle the close tags.