2013-06-04 98 views
0

我有一些表格,我只需要保留一些內容在此表中,所以我有這個jQuery也沒有選擇爲「無級」

$(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')如果他們有一個屬性類 $(this).children(':first').attr('class'),所以如果一個元素沒有類,它不會「T在如果

+1

是什麼TRUC ??? – writeToBhuwan

+0

這是我的var與 – Valinor

+4

裏面的表可能dublicate:http://stackoverflow.com/questions/1962247/jquery-get-all-divs-which-do-not-have-class-attribute –

回答

0

進入Try

!$(this).children(':first').get(0).className 
+0

似乎沒有工作,我有同樣的結果。 – Valinor

0

檢查屬性,這樣

(!$(this).children(':first').not('[class]'))