Q:

Jquery Last-Child or Nth-Child if == "SALE"

I have a drop down menu and I am trying to change the last item of the list only if the string  equals "SALE" and make it RED.  I am able to successfully select any item in the list by either using nth-child or last-child but not all drop downs have the <li> string SALE.  How can I achieve this using jQuery? 
jQuery('ul.top-cat-links li.top-cat-tops a:last-child').css('color','#ff0000');    

A:

If SALE isn't directly in the li element, you can use :has:
ul.top-cat-links li.top-cat-tops:has(:contains("SALE")) a:last-child

If it is, you can just use :contains:
ul.top-cat-links li.top-cat-tops:contains("SALE") a:last-child

Using JavaScript to add classes like this isn't a good idea.  Why don't you add them with your serverside language?