How To set style to next element using jquery

im setting css style to next element using jquery…
i want set css style to next .comment by click on .show_cmt class but
it wont work.

<script> 
var cmt = true;
$(document).on('click','.show_cmt',function(e){
if(cmt == true){
$(this).next('.comment').animate({backgroundColor: 'red'},500);
cmt = false;
}
else
{
$(this).next('.comment').animate({backgroundColor: 'black'},500);
cmt = true;
}
})
</script>

Can you show us your HTML? A small demo on codepen maybe?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.