I am trying to enable click function on every link with the same class name and unique id. But the problem is click function is working only on first link. The number of links are unknown they can be 1 , 2 , 3 or any...
so Buy getting the number of links with the same class name trying to make a loop for every click function..Can anyone please help me!
the code I am trying is
<a class="divclasss" id="clicki25" >
<i class="fa fa-envelope"></i>
</a>
<a class="divclasss" id="clicki26" >
<i class="fa fa-envelope"></i>
</a>
<a class="divclasss" id="clicki27" >
<i class="fa fa-envelope"></i>
</a>
Jquery code I am using is
alert($('.divclasss').attr("id"));
for (var i=0; i<$('.divclasss').length; i++) {
$("#id").click(function(){
///
});
}
1.) How can I know the total number of links? 2.) For every div with unique id enabling click function.