jQuery selector where text = some value

后端 未结 9 1133
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 17:12

I have an object (in this case a rating object from js-kit) that I want to make invisible if the rating value is \'unrated\'. I\'m having trouble with getting the right jQue

9条回答
  •  再見小時候
    2020-12-03 17:37

    Based on the HTML you provided,I don't see where the 'unrated' text you're testing for is coming from.

    However, if that is the entirety of the text in that div, just test for it directly.

    if ($('.js-rating-labelText').text() == 'unrated'){
      $(this).hide();
    }
    

提交回复
热议问题