Here is my code. When I "toggle thumbs-up glyphicon" and try to get value of its class name on click of downvote button. It gives undefined value.
P.s. When I try to get its value in its own function, it works fine.
<div style="float:right">
<a class="upvotebtn" href="#" ><i class="fa fa-thumbs-o-up"></i>10000</a>
<a class="downvotebtn" href="#" ><i class="fa fa-thumbs-o-down"></i>10000</a>
</div>
$('.upvotebtn').click(function(){
$(this).find('i').toggleClass('fa-thumbs-o-up').toggleClass('fa-thumbs-up');
$(this).toggleClass('upvotebtn').toggleClass('upvotebtn-highlight');
});
$('.downvotebtn').click(function(){
$(this).find('i').toggleClass('fa-thumbs-o-down').toggleClass('fa-thumbs-down');
$(this).toggleClass('downvotebtn').toggleClass('downvotebtn-highlight');
});