jQuery获取鼠标事件源

时间:2020-07-04 14:44:47   收藏:0   阅读:51

jQuery获取鼠标事件源(万能)


//任意位置

$(document).ready(function(){

    $(document).click(function(){
         $("#id_").hide();
     });

});

//是否获得焦点:

if($("#mybtn").is(":focus")){
   doSomethingHere();
}


这种方式适用于任何地方,特别是调用其他js组件时,没有办法获取事件源的时候,通过这种方式是做比较妥当。


原文:https://www.cnblogs.com/meijifu/p/13234692.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!