Let’s say i have list
<ul id="left-side-menu" style="display: block;">
<li> <a id="1" class="lists active" href="javascript:void(0)">My company 1</a></li>
<li> <a id="2" class="lists" href="javascript:void(0)">My company 2</a></li>
<li> <a id="3" class="lists" href="javascript:void(0)">My company 3</a></li>
</ul>
In order to get the id of an element which has active class using the lists class, i wrote like this
$(“a.lists”).hasClass(“active”).attr(‘id’);
but it gives an error
$(“a.lists”).hasClass(“active”).attr is not a function
Please help me
1 Answer