0

私はいくつかのテーブルを持っており、このテーブルにはいくつかのコンテンツのみを保持する必要があるため、これを持っています

 $(truc).find('tr').each(function(lig) {
        if (lig != 0 && (!$(this).children(':first').not('')) && (!$(this).children(':first').hasClass('main-title')) && (!$(this).children(':first').hasClass('top-top-title'))) {
            $(this).remove();
        }
        ;
    }

(!$(this).children(':first').not(''))最初の子にクラスがなく(空のクラスでさえない)行を選択する必要があり、必要な指示がわからないため、ヘルプが必要です

編集:$(this).children(':first')属性 class があるかどうかを チェックするように自分で解決した$(this).children(':first').attr('class')ので、要素にクラスがない場合は、 if に入りません

4

2 に答える 2

0

試す

!$(this).children(':first').get(0).className
于 2013-06-04T10:03:11.067 に答える
0

このように、属性を確認します

(!$(this).children(':first').not('[class]'))
于 2013-06-04T10:03:12.670 に答える