I am trying to put a click function on a php loop.
But its doing part or all of the function on all the links..
I thought if used "this" it would solve it but it's not working..
Here is the jquery:
if ($('#like').hasClass('notlike')); {
$('.likeon').click(function () {
$('#like span.message', this).text('Yes I Like It');
});
};
Here is the html:
<li id="like" class="notlike">
<span>(3) Likes <br>
<span class="message">
<a href="javascript:;" class="likeon">Do You Like it?</a>
</span>
</span>
</li>
I am looping with php so the link appears 5 times. What Am I doing Wrong?