Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 7
    how about when using $(this) or a variable object?
    – t q
    Commented Feb 1, 2014 at 1:36
  • then, use var temp = $(yourElement).parent().find(":hover"); return temp.length == 1 && temp[0] == yourElement; Commented Mar 14, 2015 at 3:58
  • 1
    Doesn't work in jQuery 3.1.1... I try $('#myid:hover').length > 0 in an event handler.
    – Legends
    Commented Mar 1, 2017 at 16:15
  • Not always possible when you want to check elements with global classes and no ids. $(this) not possible to ":hover" in selector!
    – Kareem
    Commented Mar 12, 2017 at 6:00
  • 2
    .filter(:hover) seems to always return an object, and filter(:hover).length works. Please consider updating.
    – konsolebox
    Commented Jun 27, 2018 at 12:20