I tried to save an element into a variable like this:
var callID = 3;
$active2 = $(".paging a[rel='callID']");
The class “paging” looks like this:
<div class="paging">
<a href="#" rel="1">1</a>
<a href="#" rel="2">2</a>
<a href="#" rel="3">3</a>
</div>
But when I am consol.log($active2) there is only “[]” a empty bracket…so something has to be wrong about this part:
$active2 = $(".paging a[rel='callID']");
Can someone help me to solve this problem?
-Thanks
Kind Regards
Try:
callID is the name of a variable, so in your examples you were literally looking for a anchor tag who had a
relattribute ofcallID.Also, unrelated to your problem, don’t forget to declare you
$active2variable somewhere.