gespinha
gespinha

Reputation: 8487

JQuery mouseenter, mouseleave function

Is these JQuery solution for a mouseenter/mouseleave function correct? Even though I know it works, can this be vulnerable in any way?

$('.button').on('mouseenter mouseleave',function(){
    $('.object').stop().slideToggle(250);
});

Upvotes: 0

Views: 46

Answers (1)

user3339662
user3339662

Reputation: 66

Well, it works, and it seems to be semantically correct. I'd say it's fine. I'm not sure about what you mean by possible vulnerabilities.

Although, you might want to shorten your code a bit, like so:

$('.button').hover(function()
{
    $('.object').stop().slideToggle(250);
});

Upvotes: 1

Related Questions