Remove elements with only a   space using jQuery

后端 未结 8 763
北恋
北恋 2020-11-30 07:34

Is there a way to remove this

using jQuery?

8条回答
  •  春和景丽
    2020-11-30 08:07

    This could be a better solution for CMSs. Some rich text editors add   inside empty paragraphs.

        $("p").filter( function() {
    
            var html = $(this).html();
    
            if(html == '' || html == ' ')
                return true;
    
        }).addClass('emptyP');
    

提交回复
热议问题