Is there a way to dynamically add an "active" class to an element based on the href?
This is what my template in Django looks like:
<div class="panel side-panel-1 category">
<h4 class="title1">Sections</h4>
<ul class="clear-list">
{% for section in sections %}
<li>
<a href="/advert/adverts.aspx&sec{{ section.id }}">{{ section.name }} ({{ section.advert_set.count }})</a>
</li>
{% endfor %}
</ul>
The URLs will be generated using section.id
For example:
- mysite.com/advert/adverts.aspx&sec1
In some cases, it may look like this:
- mysite.com/advert/adverts.aspx&sec1&cat10&page1