Is it possible to associate a jquery call with two CSS selectors?

I want to bind a call mouseoutto two CSS selectors so that if I move my mouse from one AND the other element, then I call something else. Is it possible?

+3
source share
2 answers

You can use something like

$("#selector1, #selector2").bind("mouseout", function(){
    // code goes here
});

Read Multiple Selector ("selector1, selector2, selectorN")

+5
source
$('.class1, .class2').mousemove(callbackFunction);
JQuery selectors work just like CSS does. Just use a comma to separate the classes.
0
source

All Articles