removeClass & addClass not working
remove & addClass functions do not work. I am trying trying to make sure that the span class changes to a new one once it is clicked.
here's the jquery code:
- $('.vote_btn').click(function(){
$.ajax({
url:'/joseph/pages/votes.php',
type: 'post',
//dataType:'json',
data:{'comment_id':$(this).data('commentid')},
success: function(data){
if(data == 'up'){
$(this).removeClass('fa-thumbs-o-up').addClass('fa-thumbs-up');
} else if(data == 'reversed') {
$(this).removeClass('fa-thumbs-up').addClass('fa-thumbs-o-up');
} else {
alert(data);
}
}
});
});
});
and here is the HTML code:
- <span id="<?=$comment['id']?>" class="fa fa-thumbs-o-up vote_btn"></span>