jquery remove list item where .text() = 'blabla'

后端 未结 3 947
后悔当初
后悔当初 2020-12-11 01:31

I have the following structure

  • something
  • ...
  • blabla
  • <
3条回答
  •  醉话见心
    2020-12-11 02:01

    If you want a contains (substring match) then :contains() works:

    $('li:contains("blabla")').remove();
    

    If you want an exact match, e.g. not matching "blablabla", you can use .filter():

    $('li').filter(function() { return $.text([this]) === 'blabla'; }).remove();
    

提交回复
热议问题