css - Add active class to element according to URL Jquery Django -
how can add "active" class element according href i have django template this: <div class="panel side-panel-1 category"> <h4 class="title1">Разделы</h4> <ul class="clear-list"> {% section in sections %} <li> <a href="/advert/adverts.aspx&sec{{ section.id }}">{{ section.name }} ({{ section.advert_set.count }})</a> </li> {% endfor %} </ul> so urls formed section.id example: mysite.com/advert/adverts.aspx&sec1 in cases be: mysite.com/advert/adverts.aspx&sec1&cat10&page1 maybe want this. use class="{{ section.id ? 'active' : '' }}" . if section.id exists, active wile add. <div class="panel side-panel-1 category"> <h4 class="title1">Разделы</h4> <ul class="clear-list"> {% section in sections %} <li class="{{ section.id ? 'a...