I need to add the class .active-trail to an li element if the li element has a link (a) as a child element containing the word "Help".
Example:
<li class="last expanded dropdown">
<a href="/test1" title="" class="dropdown-toggle" data-target="#" data toggle="dropdown">
Help <span class="caret"></span>
</a>
</li>
<li class="last expanded dropdown">
<a href="/test1" title="" class="dropdown-toggle" data-target="#" data toggle="dropdown">
Contact <span class="caret"></span>
</a>
</li>
In the example above, I would like to add the class active-trail to the first li like so:
<li class="last expanded dropdown active-trail">
<a href="/test1" title="" class="dropdown-toggle" data-target="#" data toggle="dropdown">
Help <span class="caret"></span>
</a>
</li>
<li class="last expanded dropdown">
<a href="/test1" title="" class="dropdown-toggle" data-target="#" data toggle="dropdown">
Contact <span class="caret"></span>
</a>
</li>
Is this possible through javascript/jQuery, and if so, how? Thanks!