Imagine a situation where I would like to put rows in a table dynamically:
<table>
<tr><th>Title</th><th>Author</th>
<div class="rowsGoHere"></div>
</table>
The problem with this code is that Chrome, for instance, considers <div>
inside a <table>
to be illegal, and the resulting page code I see in inspector is the following:
<div class="rowsGoHere"></div>
<table>
<tr><th>Title</th><th>Author</th>
</table>
So Chrome automatically puts this div above the table. Now the question is, how do I avoid this situation? Is it possible to use something other than this <div>
which I can later reference to insert elements into or after it? I should also point out the requirement that this element should be generic: I can't just use <tr class="rowsGoHere">
.
This is a strictly html validity question, please do not recommend any jQuery code or something similar.