jQuery find exact HTML content

前端 未结 5 792
死守一世寂寞
死守一世寂寞 2021-01-28 13:06

I am using the following script to find all h1 elements, within a parent ID container that will fit a curtain criteria...

$(\'#cpcompheader h1\').html(\"&nbs         


        
5条回答
  •  终归单人心
    2021-01-28 13:48

    I guess you could do something like:

    $('h1:contains( )');
    

    or if you want the exact match:

    $('h1').filter(function(index) { return $(this).text() === " "; });
    

    you could also look at the contains selector documentation: https://api.jquery.com/contains-selector/

提交回复
热议问题