I need to apply a class to the <li>
tag that encloses an anchor tag when a user clicks on the link. Like this:
<ul>
<li><a href="#">Just an Example</a></li>
</ul>
So when the user clicks on <a href="#">Just an Example</a>
, I need to apply a class to the <li>
enclosing it. How would I target this? I am using jquery.