Skip to content Skip to sidebar Skip to footer

How To Move Table To The Top Of The Div Container Based On A Condition With Jquery?

I have multiple tables stacked inside a div container as below:-

Solution 1:

$('td:contains(N/A)').closest('table').prependTo('#myContent');

jsFiddle example


Solution 2:

$('td').each(function(){
    if ($(this).text() === 'N/A') {
        $(this).parents('table').detach().prependTo('#myContent');
    }
});

Post a Comment for "How To Move Table To The Top Of The Div Container Based On A Condition With Jquery?"