I need to upgrade jQuery from 1.11.1 to 3.5.1 and in some of the codebase I found .hover(function(){}, funtion(){}) being implemented.
I wonder if this is deprecated and won't work in future version of jQuery? I have checked if it works in latest version and it works as expected but found that
$(element).on('hover', function(){
$(this).addClass('abc');
})
doesn't work. I have gone through some SO QA and found that instead need to use mouseenter and mouseleve
$(element).on('mouseenter', function(){
$(this).addClass('abc');
}).on('mouseleave', function(){
$(this).removeClass('abc');
});
Also is it recommended to use .on(.....) method in latest version of jQuery instead of using .hover(....)?
So can you point me if I can leave .hover(function(){}, function(){}) as it is or should I rewrite it to .on('mouseenter', function(){}).on('mouseleave', function(){})