How to detect mouseleave() on two elements at once?

后端 未结 5 1336
别跟我提以往
别跟我提以往 2020-12-06 11:15

Answer can be in vanilla js or jQuery. I want to hide a div with the id \"myDiv\" if the user is no longer hovering over a link with the id \"myLink\" or a span with the id

5条回答
  •  無奈伤痛
    2020-12-06 11:56

    You could use a multiple selector:

    $("#someElement, #someOtherElement").mouseleave(function() {
       // Do something.
    });
    

提交回复
热议问题