jquery - Remove duplicated table column incl. table head to new table -


i've tried different workarounds , modified scripts can't in way i'd to

i've table , duplicated columns (inclusive additional table th) should moved table 2 ... different columns should stay in table 1

<table width="200" border="1"> <tbody> <tr>   <th scope="col">colour</th>   <th scope="col">weight</th>   <th scope="col">width</th>   <th scope="col">size</th>   <th scope="col">price</th> </tr> <tr>   <td>black</td>   <td>20kg</td>   <td>10cm</td>   <td>xl</td>   <td>20,90€</td> </tr> <tr>   <td>green</td>   <td>20kg</td>   <td>8cm</td>   <td>xl</td>   <td>20,90€</td> </tr> <tr>   <td>red</td>   <td>20kg</td>   <td>5cm</td>   <td>xl</td>   <td>10,00€</td> </tr>  </tbody> </table> 

any snippet or possible workaround?

here snippet started

$("table tbody tr").each(function (index, option)             {                 var firstcolumnval = $(this)[0].cells[0].innertext;                 var secondcolumnval = $(this)[0].cells[1].innertext;                 $("table tbody tr").each(function (index1, option1)                 {                     // avoid same column comparision                         if(index != index1)                     {                         // 1st column check                         if ($(this)[0].cells[0].innertext == firstcolumnval)                         {                             // duplicate found - remove element or move other table                         }                          // 2nd column check                          if ($(this)[0].cells[1].innertext == secondcolumnval) {                             // duplicate found - remove element or move other table                          }                     }                 });             }); 

do same other columns.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -