How to find li whose text starts with a particular string?

后端 未结 2 1858
轻奢々
轻奢々 2020-12-20 20:13

I have a function to get the

  • tag at the top that contains the key specified to it, anywhere in the text.

    But I want to have the

  • 2条回答
    •  忘掉有多难
      2020-12-20 20:50

      Please check filter() in jquery.

      Filter

      Filter demo as specified in api.jquery

       $('li').filter(function(index) {
         return $('strong', this).length == 1;
       }).css('background-color', 'red');​
      

    提交回复
    热议问题