我需要将表行包装成div [英] I need to wrap up table row into div
本文介绍了我需要将表行包装成div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要把表行包装成div,我做
I need to wrap up table row into div, I do
$('table tr').each(function(){
$(this).insertBefore('<div>');
$(this).insertAfter('</div>');
})
但似乎不起作用
UPDATE
fidle http://jsfiddle.net/EsdR2/1/
推荐答案
如果你试图将它们划分为单独的部分而不是一行,那么可以尝试使用tbody方法。
If you are trying to break them into separate section for so than a row, then maybe try the tbody approach.
<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 ..
Edit after seeing fade out then you can try this javascript..
var firstPart = $('tbody.first-part');
var secondPart = $('tbody.second-part');
$('#SomeButton').click(function () {
firstPart.fadeOut("fast");
secondPart.fadeIn("slow");
});
这是一个有fadeout工作的jsFiddle。 http://jsfiddle.net/u3fNL/1/
Here a jsFiddle with fadeout working. http://jsfiddle.net/u3fNL/1/
这篇关于我需要将表行包装成div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文