I know this has been asked many times before, but I could not find anything that worked. I will need to add a class to a div that gets autogenerated over my ul.
This is my html code:
JavaScript
x
7
1
<div class="wrapper">
2
<ul id="bx-pager">
3
<li><a><img></a></li>
4
<li><a><img></a></li>
5
</ul>
6
</div>
7
I need to add a second class to div class “wrapper”, but after what I have tried I can’t get it to work. I would be nice if someone can help me out with this simple task, but showing me how to do it. I don’t have much experience with jQuery, but need it now.
Advertisement
Answer
You can use the JQuery parent selector:
JavaScript
1
2
1
$('#bx-pager').parent('div').addClass('newClass');
2