I have a situation where I cannot change a site's dynamically generated code but I can add HTML/JS to it with jQuery. I have a three table cells in a row. I want to take the third cell and put it on a new <tr>
The example code below illustrates what I am trying to do. The problem with using this
$("</tr><tr class='row_two'><td class='new_cell'> </td>").insertBefore(".third");
is that it makes a new <tr> but it closes that immediately instead of absorbing the <td> below it. Any advice would be great.
<table>
<tr class="row_one">
<td class="first">First Cell</td>
<td class="second">Second Cell</td>
<td class="third">Third Cell</td>
</tr>
</table>
---I want it to turn into this----
<table>
<tr class="row_one">
<td class="first">First Cell</td>
<td class="second">Second Cell</td>
</tr>
<tr class="row_two">
<td class="new_cell"> </td>
<td class="third">Third Cell</td>
</tr>
</table>