var $Sba = $('.sidebar-right a'); var $Sbsvg = $('.sidebar-right svg'); function addclass() { $Sba.hover(function() { $(this).addClass("hover"); }, function() { $(this).removeClass("hover"); }); } jQuery(document).ready(function($){ addclass(); });