HTML / jQuery中的循环/交换表行

时间:2013-01-29 15:02:19

标签: javascript jquery

我在申请中遇到了以下情况,

Cycle table rows in HTML/jQuery

但我有多个tbody标签如下

我正在tbody中动态创建tr。

我的HTML

 <table id="tblmain">
   <thead>
    <tr>
        <th scope="col" class=""></th>
        <th scope="col" class=""></th>
        <th scope="col" class="">Opening</th>
        <th scope="col" class="">Current</th>
    </tr>
</thead>
      <tbody id="1">
        <tr id="fixed">
            <td class=""><img src="flags/USD.png" /></td>
            <td>Selection 1</td>
            <td class=""><span>3.1</span></td>
            <td class=""><span>3.1</span></td>

        </tr>
        <tr id="fixed">
            <td ><img src="flags/EUR.png" /></td>
            <td>Selection 2 </td>
            <td ><span>5.10</span></td>
            <td ><span>3.1</span></td>
        </tr>

        <tr class="hidden"> <!--THIS SHOWS FIRST---->
            <td class=""><img src="flags/CAD.png" /> </td>
            <td>Selection 3</td>

            <td class=""><span>8.10</span></td>
            <td class=""><span>3.1</span></td>
        </tr>

        <tr class="hidden"><!---THIS SHOWS FIRST--->
            <td class=""><img src="flags/CNY.png" /> </td>
            <td>Selection 4</td>

            <td class=""><span>8.10</span></td>
            <td class=""><span>3.1</span></td>
        </tr>

    </tbody>
      <tbody id="2">
    <tr id="fixed">
        <td class=""><img src="flags/USD.png" /></td>
        <td>Selection2 1</td>
        <td class=""><span>3.1</span></td>
        <td class=""><span>3.1</span></td>

    </tr>
    <tr id="fixed">
        <td ><img src="flags/EUR.png" /></td>
        <td>Selection2 2 </td>
        <td ><span>5.10</span></td>
        <td ><span>3.1</span></td>
    </tr>

    <tr class="hidden"> <!--THIS SHOWS FIRST---->
        <td class=""><img src="flags/CAD.png" /> </td>
        <td>Selection2 3</td>

        <td class=""><span>8.10</span></td>
        <td class=""><span>3.1</span></td>
    </tr>

    <tr class="hidden"><!---THIS SHOWS FIRST--->
        <td class=""><img src="flags/CNY.png" /> </td>
        <td>Selection2 4</td>

        <td class=""><span>8.10</span></td>
        <td class=""><span>3.1</span></td>
    </tr>
    <tr class="hidden"><!---THIS REPLACES THE ROWS ABOVE--->
        <td class=""><img src="flags/CNY.png" /> </td>
        <td>Selection2 5</td>

        <td class=""><span>81.10</span></td>
        <td class=""><span>31.1</span></td>
    </tr>



</tbody>
</table>

如何在所有tbody标签中循环表行?

帮助将不胜感激。

谢谢,

0 个答案:

没有答案