jQuery Multiple $(this) not working -
i use 2 $(this) in function second $(this) not working
$('.port-cat li').on( 'click', function() { $(this).addclass('current-cat').siblings().removeclass('current-cat'); $(this).parents('.portfolio_cat').removeclass('current-cat'); // code not working }); but if remove first $(this) code start working
$('.port-cat li').on( 'click', function() { $(this).parents('.portfolio_cat').removeclass('current-cat'); // it's working }); how make both $(this) code working without removing one?
you have add other class use
$(this).addclass('current-cat').siblings().removeclass('current-cat'); so li element has 2 class. can't use $(this) more, use $("classname") replace $(this).
Comments
Post a Comment