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
Perhaps the issues is with the :contains('Unrated')
part of the function. As changing the text to any random value produces the same result:
$("#ratingDiv:contains('somerandomtext')").hide();
You can create your own selector methods
For example, if you want to be able to do the following:
$('.js-rating-label:hasText(unrated)');
You can define the hasText
method as follows
$.expr[':']['hasText'] = function(node, index, props){
return node.innerText.contains(props[3]);
}
props[3]
contains the text inside the brackets after ':hasText'.
You might consider using the hide() / show() methods as well.
$(".js-rating-labelText:contains('unrated')").hide()