jquery: remove table row while iterating through table rows

Posted by deostroll on Stack Overflow See other posts from Stack Overflow or by deostroll
Published on 2010-06-16T14:50:32Z Indexed on 2010/06/16 14:52 UTC
Read the original article Hit count: 144

Filed under:
|
|
|

#exceptions is a html table. I try to run the code below, but it doesn't remove the table row.

$('#exceptions').find('tr').each(function(){
    var flag=false;
    var val = 'excalibur';
    $(this).find('td').each(function(){
        if($(this).text().toLowerCase() == val) 
            flag = true;
    });
    if(flag)
        $(this).parent().remove($(this));
});

What is the correct way to do it?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html