Here is my code:
jQuery('a.students').on('click',function(e){
alert(1);
});
I create my HTML using jQuery. The preceding code is placed underneath my html creation. Here is my HTML:
<li class="online new on "><a class="students">
<span>Some name</span></a>
<span style="background:green" class="msgcount"></span>
</li>
<li class="online new on "><a class="students">
<span>Some name</span></a>
<span style="background:green" class="msgcount"></span>
</li>
I tried moving the students
class to the li
element also. I updated my javascript to:
jQuery('li.students').on('click',function(e){
alert(1);
});
Nothing seems to be working.