Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to wrap up table row into div

Tags:

jquery

I need to wrap up table row into div, I do

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

but seems doesn't work UPDATE fidle http://jsfiddle.net/EsdR2/1/

like image 831
Oleksandr IY Avatar asked Nov 01 '25 14:11

Oleksandr IY


1 Answers

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>

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");
});

Here a jsFiddle with fadeout working. http://jsfiddle.net/u3fNL/1/

like image 58
Adam Avatar answered Nov 03 '25 05:11

Adam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!