jQuery table replace

Posted by Happy on Stack Overflow See other posts from Stack Overflow or by Happy
Published on 2010-06-16T10:30:14Z Indexed on 2010/06/16 10:32 UTC
Read the original article Hit count: 181

Filed under:
|

We have a table:

<table>
<tr>
    <td width="10">1</td>
    <td>text 1</td>
</tr>
<tr>
    <td width="10">2</td>
    <td>text 2</td>
</tr>
<tr>
    <td width="10">3</td>
    <td>text 3</td>
</tr>
<tr>
    <td width="10">4</td>
    <td>text 4</td>
</tr>
<tr>
    <td width="10">5</td>
    <td>text 5</td>
</tr>
<tr>
    <td width="10">6</td>
    <td>text 6</td>
</tr>
<tr>
    <td width="10">7</td>
    <td>text 7</td>
</tr>
<tr>
    <td width="10">8</td>
    <td>text 8</td>
</tr>
<tr>
    <td width="10">9</td>
    <td>text 9</td>
</tr>
<tr>
    <td width="10">10</td>
    <td>text 10</td>
</tr>
</table>

We update this table by throwing into each <tr> 3 <td>, each <td> with width="10" attribute must be deleted.

It must look like:

<table>
<tr>
    <td>text 1</td>
    <td>text 2</td>
    <td>text 3</td>
</tr>
<tr>
    <td>text 4</td>
    <td>text 5</td>
    <td>text 6</td>
</tr>
<tr>
    <td>text 7</td>
    <td>text 8</td>
    <td>text 9</td>
</tr>
<tr>
    <td>text 10</td>
</tr>
</table>

How can we do this?

Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about table