I'm trying to add a class to a <li> where the href within it contains a string. I can apply the class to the anchor without a problem, but I can't seem to select the parent. Is an anchor a child?
<li><a href="random.xls">Random Stuff</a></li> In this case, since the href contains .xls, I'd like to be able to add a class to it. I've tried a variety of things, most recently this, but no luck: $('li has(a[href$=".xls"])').addClass('excel'); any ideas? Thanks