jQuery - check for empty TDs and if all empty hide the parent TR

前端 未结 5 2510
眼角桃花
眼角桃花 2021-02-20 01:57

I\'d like to check for empty TDs (classes a-h only) and if all are empty, then I\'d like to hide the parent TR. The issues I\'m running into are, my empty TDs contain \" \"

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-20 02:47

    $('tr').each(function(){
      var emptyTdArray=$(this).find('td:not(:.requirementRight,:empty)').filter(function() {     
      return $(this).html()!= " ";  
      });
    
      if(emptyTdArray.length==0)
      {
         $(this).hide();
      }
    });
    

提交回复
热议问题