Avatar of stargateatlantis
stargateatlantis
 asked on

jquery targeting parent to add class

I have the following code here Trying to figure out how to add a class named active to the list tag.  

<ul id='sub-nav'>
<li><a href='#one'>Item One</a></li>
<li><a href='#two'>Item Two</a></li>
<li><a href='#three'>Item Three</a></li>
<li><a href='#four'>Item Four</a></li>
</ul>

 $("#sub-nav a[href='#one'']").click(function(){
    /*Trying to figure out how to add a class named active to the list tag */
})

Open in new window

JavaScriptjQuery

Avatar of undefined
Last Comment
leakim971

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
leakim971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy