Getting all links with specific inner HTML value in jQuery

后端 未结 4 1723
时光取名叫无心
时光取名叫无心 2021-02-05 04:56

I

4条回答
  •  感动是毒
    2021-02-05 05:28

    You ask why this doesn't work:

    $('div').find('a').find(':contains("Text2")')
    

    The reason is, .find() will search children elements, you want .filter() (because you already selected the a - or you add the :contains to the a find:

    $('div').find('a').filter(':contains("Text2")');
    $('div').find('a:contains("Text2")');
    

提交回复
热议问题