3

我需要将表格行包装到 div 中,我做

$('table tr').each(function(){
    $(this).insertBefore('<div>');
    $(this).insertAfter('</div>');
})

但似乎不起作用更新小提琴http://jsfiddle.net/EsdR2/1/

4

1 回答 1

9

如果您试图将它们分成单独的部分而不是一行,那么也许可以尝试 tbody 方法。

<table class="table">
    <tbody class="first-part">
        <tr>
            <td>first</td>
        </tr>
    </tbody>
    <tbody class="second-part" style="display:none">
        <tr>
            <td>second</td>
        </tr>
    </tbody>
</table>

看到淡出后编辑然后你可以试试这个javascript ..

var firstPart = $('tbody.first-part');
var secondPart = $('tbody.second-part');

$('#SomeButton').click(function () {
    firstPart.fadeOut("fast");
    secondPart.fadeIn("slow");
});

这是一个带有淡出工作的jsFiddle。 http://jsfiddle.net/u3fNL/1/

于 2013-09-04T15:27:46.330 回答