Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if an element is being hovered over

I want to check if a element is being hovered over. I get this error:

Syntax error, unrecognized expression: unsupported pseudo: hover

when I use this code:

 $('.class').blur(function(){
    if(!$(this).is(':hover')){
       //element not being hovered over
    }
 });

i also tried this:

 $('.class').blur(function(){
    if($(this+":hover").length === 0){ 
       //element not being hovered over
    }
 });

this also does not work. Is there any other way of doing this. Thanks.

like image 331
user2014429 Avatar asked Mar 08 '15 17:03

user2014429


1 Answers

$(".class").mouseover(function(){   
    $(this).attr('checked',true);   
    });  
});
like image 153
Abhishek Pachal Avatar answered Sep 30 '22 07:09

Abhishek Pachal