简体   繁体   中英

Is it possible to bind a jquery call to two CSS selectors?

I want to bind a mouseout call to two CSS selectors so that if I've moved my mouse from one AND the other element, then I call something else. Is this even possible?

You can use something like

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

Read Multiple Selector (“selector1, selector2, selectorN”)

$('.class1, .class2').mousemove(callbackFunction);

jQuery selectors work just like CSS. Just use a comma to separate the classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM