I have jQuery code that adds class feather to the div on mouseover if it has class active-s-c-card. I need to remove this class on mouseleave. Would be happy for any suggestions how to improve the current code. Thanks!
feather
active-s-c-card
mouseleave
jQuery(document).ready(function($) { $("body").on("mouseover" ,function(){ if ($(".panel-s-c-3").hasClass("active-s-c-card")) { $(".panel-s-c-3").addClass("feather"); } }); });
There you go, when leaving the active-s-c-card element:
$(".active-s-c-card").on("mouseleave" ,function(){ $(this).removeClass("feather") });
2.1m questions
2.1m answers
60 comments
56.8k users