Question

I want to create a hover button when "body" or "p" is hover, that means either one of them will trigger the hover event, how do you do that?

I assumed is something like this?

$("body")||$("p").mouseenter(function () {....}); 
Was it helpful?

Solution

jQuery selector work like CSS selector, when you want multiple elements, you use comma :

$("body, p").mouseenter(function () {....}); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top