I get a page from an external site where I have no control. Now the table has something like this:
<table><tbody>
<tr><td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr><td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody></table>
I get all this TD in all one line. now with jquery I want to fix this using every 5 TD samples, it should add a close </tr>and add a open <tr>, and the remaining TD should go inside them
Trying to do the following:
if($("#container").find("table>tbody>tr>td").length <=5)){
do the breaking here
}
Here is the update, I forgot to mention: in the first line, the rows always contain the tables in td, and the second reow always contains the data, I tried something like this:
$('#mypahe form table>tbody>tr:odd').each(function(){
$('<tr>').insertAfter(this).append($('>:gt(4)',this))
});
but it started with the fact that the labels are on the same line and at the bottom, it splits tr into two tr
I updated the question, where is the code that I tried, and U gave work only in the first part, and it never works in the second tr