Jquery addClass to containing li based on a href contents

Jquery addClass to containing li based on a href contents

Hi, I've tried various snippets of code to try to get this working on my Wordpress site but without success. I have a structure:

<div class...>
<ul>
<li class...><a href... </li>
<li class...><a href... </li>
<li class...><a href... </li>
</ul>
</div>

I am trying to add an additional class to the containing li if the a href contain '/project/' somewhere within it.

This is the code I have tried + various other permutations without success. The JQuery is in a linked js file which I know is linked correctly as I have checked via a simple alert:

  1. jQuery(document).ready(function($){
  2. $('li.bawmrp_manual').find('a[href*="/project/"]').addClass('bawmrp_gallery');
  3. })

Can anyone assist?